Class LambdaType<T>
public abstract class LambdaType<@NonNull T>
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description LambdaType()Constructs a newLambdaType. -
Method Summary
Modifier and Type Method Description protected @NonNull java.lang.Objectclone()@NonNull LambdaType<T>defineClassesWith(@NonNull java.lang.invoke.MethodHandles.Lookup defineLookup)Constructs a newLambdaTypewhere that will define the implementation class using the provided lookup.booleanequals(@Nullable java.lang.Object obj)protected voidfinalize()Deprecated.@NonNull java.lang.Class<T>getFunctionClass()Gets the function class that will be implemented.@NonNull java.lang.reflect.TypegetFunctionType()Gets the function type that will be implemented.@NonNull java.lang.reflect.MethodgetMethod()Gets theMethodthat will be implemented when generating a function for thisLambdaType.inthashCode()static <@NonNull T>
@NonNull LambdaType<T>of(@NonNull java.lang.Class<@NonNull T> functionType)Constructs a newLambdaTypefrom the given function interface or abstract class.static <@NonNull T>
@NonNull LambdaType<T>of(@NonNull java.lang.reflect.Type functionType)Constructs a newLambdaTypefrom the given function interface or abstract class type.@NonNull java.lang.StringtoString()Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
LambdaType
public LambdaType()Constructs a newLambdaType.The generic signature from the extended class will be used to determine the functional interface to implement. If it's not resolved, a
IllegalStateExceptioncan be expected.
-
-
Method Details
-
of
public static <@NonNull T> @NonNull LambdaType<T> of(@NonNull java.lang.Class<@NonNull T> functionType)Constructs a newLambdaTypefrom the given function interface or abstract class.A functional abstract class is either a interface or a "abstract" class that has a no-arg constructor. In both cases is only one abstract method allowed.
- Type Parameters:
T- The type of the function type- Parameters:
functionType- The function type- Returns:
- The lambda type
- Throws:
java.lang.IllegalArgumentException- If no valid functional method could be found
-
of
Constructs a newLambdaTypefrom the given function interface or abstract class type.A functional abstract class is either a interface or a "abstract" class that has a no-arg constructor. In both cases is only one abstract method allowed.
The generic signature of the given
Typewill be retained by a resulting function.- Type Parameters:
T- The type of the function- Parameters:
functionType- The function type- Returns:
- The lambda type
- Throws:
java.lang.IllegalArgumentException- If no valid functional method could be found
-
defineClassesWith
public final @NonNull LambdaType<T> defineClassesWith(@NonNull java.lang.invoke.MethodHandles.Lookup defineLookup)Constructs a newLambdaTypewhere that will define the implementation class using the provided lookup.When the functional interface/abstract class isn't public, or the abstract method isn't, then should the lookup be defined explicitly. Its implementation class needs the proper access in order to be implemented successfully. This can be in the same package or a different one depending on what is desired.
- Parameters:
defineLookup- The define lookup- Returns:
- The new lambda type
-
getFunctionClass
Gets the function class that will be implemented.- Returns:
- The function class
-
getFunctionType
public final @NonNull java.lang.reflect.Type getFunctionType()Gets the function type that will be implemented.- Returns:
- The function type
-
getMethod
public final @NonNull java.lang.reflect.Method getMethod()Gets theMethodthat will be implemented when generating a function for thisLambdaType.- Returns:
- The method
-
toString
public final @NonNull java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
equals
public final boolean equals(@Nullable java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public final int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
clone
protected final @NonNull java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
finalize
@Deprecated protected final void finalize()Deprecated.- Overrides:
finalizein classjava.lang.Object
-