Class FunctionalClass<T>

  • Type Parameters:
    T - the type of the class.

    public final class FunctionalClass<T>
    extends java.lang.Object
    A wrapper around Class that can be used to extract callable lambdas to methods and fields.

    Currently, used in the DSL around ConflictResolution.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      <F> @NonNull FunctionalProperty<T,​F> field​(@NonNull java.lang.String name)
      Returns the functional field with the given name.
      @NonNull java.lang.Class<T> getClazz()
      The wrapped class.
      java.util.function.Supplier<T> getConstructor()
      Returns the no-arg constructor as a Supplier.
      int hashCode()  
      static <T> FunctionalClass<T> of​(@NonNull java.lang.Class<T> clazz)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • field

        @NonNull
        public <F> @NonNull FunctionalProperty<T,​F> field​(@NonNull
                                                                @NonNull java.lang.String name)
        Returns the functional field with the given name. The field can be used to newInstance a getter or setter.
        Type Parameters:
        F - the type of the field.
        Parameters:
        name - the name of the field.
        Returns:
        the field.
        Throws:
        java.lang.IllegalArgumentException - if a field with the given name does not exist.
      • getConstructor

        public java.util.function.Supplier<T> getConstructor()
        Returns the no-arg constructor as a Supplier.
        Returns:
        a supplier around the no-arg constructor.
        Throws:
        java.lang.IllegalStateException - if no such constructor exists.
      • getClazz

        @NonNull
        public @NonNull java.lang.Class<T> getClazz()
        The wrapped class.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • of

        public static <T> FunctionalClass<T> of​(@NonNull
                                                @NonNull java.lang.Class<T> clazz)