Package com.bakdata.util
Class FunctionalClass<T>
- java.lang.Object
-
- com.bakdata.util.FunctionalClass<T>
-
- Type Parameters:
T- the type of the class.
public final class FunctionalClass<T> extends java.lang.ObjectA wrapper aroundClassthat 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 booleanequals(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 aSupplier.inthashCode()static <T> FunctionalClass<T>of(@NonNull java.lang.Class<T> clazz)java.lang.StringtoString()
-
-
-
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 aSupplier.- 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
of
public static <T> FunctionalClass<T> of(@NonNull @NonNull java.lang.Class<T> clazz)
-
-