Package com.bakdata.util
Class FunctionalMethod<T>
- java.lang.Object
-
- com.bakdata.util.FunctionalMethod<T>
-
- Type Parameters:
T- the type of the class.
public final class FunctionalMethod<T> extends java.lang.ObjectA lambda wrapper around the a method of a class. The wrapped method can be used as a lambda withnew FunctionalMethod(m)::invoke.
-
-
Constructor Summary
Constructors Constructor Description FunctionalMethod(@NonNull java.lang.reflect.Method method)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)@NonNull java.lang.reflect.MethodgetMethod()The wrapped method.inthashCode()<R> Rinvoke(T instance, java.lang.Object... params)Invokes the method on an instance with the given parameters.java.lang.StringtoString()
-
-
-
Method Detail
-
invoke
@NonNull public <R> R invoke(T instance, java.lang.Object... params)
Invokes the method on an instance with the given parameters.- Parameters:
instance- the instance, on which to invoke the method, or null for static methods.params- the parameters to pass to the method.- Returns:
- the result.
- Sneaky Throws:
- IllegalAccessException (sneaky), Exception if any
InvocationTargetExceptionoccurs
-
getMethod
@NonNull public @NonNull java.lang.reflect.Method getMethod()
The wrapped method.
-
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
-
-