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.Object
A wrapper aroundClass
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 aSupplier
.int
hashCode()
static <T> FunctionalClass<T>
of(@NonNull java.lang.Class<T> clazz)
java.lang.String
toString()
-
-
-
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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
of
public static <T> FunctionalClass<T> of(@NonNull @NonNull java.lang.Class<T> clazz)
-
-