Class MethodFunction
- java.lang.Object
-
- net.officefloor.plugin.clazz.method.MethodFunction
-
- All Implemented Interfaces:
ManagedFunction<Indexed,Indexed>
public class MethodFunction extends java.lang.Object implements ManagedFunction<Indexed,Indexed>
ManagedFunctionto invoke aMethod.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description MethodFunction(MethodObjectFactory methodObjectInstanceFactory, java.lang.reflect.Method method, ClassDependencyFactory[] parameterFactories, MethodReturnTranslator<java.lang.Object,java.lang.Object> returnTranslator)Initiate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(ManagedFunctionContext<Indexed,Indexed> context)Executes the function.java.lang.reflect.MethodgetMethod()Returns theMethodfor theManagedFunction.static java.lang.ObjectinvokeMethod(java.lang.Object instance, java.lang.reflect.Method method, java.lang.Object[] parameters)
-
-
-
Constructor Detail
-
MethodFunction
public MethodFunction(MethodObjectFactory methodObjectInstanceFactory, java.lang.reflect.Method method, ClassDependencyFactory[] parameterFactories, MethodReturnTranslator<java.lang.Object,java.lang.Object> returnTranslator)
Initiate.- Parameters:
methodObjectInstanceFactory-MethodObjectFactory. Will benullif staticMethod.method- Method to invoke for thisManagedFunction.parameterFactories-ClassDependencyFactoryinstances.returnTranslator-MethodReturnTranslatorornull.
-
-
Method Detail
-
invokeMethod
public static java.lang.Object invokeMethod(java.lang.Object instance, java.lang.reflect.Method method, java.lang.Object[] parameters) throws java.lang.Throwable- Parameters:
instance- Instance. May benullif staticMethod.method-Method.parameters- Parameters.- Returns:
Methodreturn value.- Throws:
java.lang.Throwable- Failure invoking theMethod.
-
getMethod
public java.lang.reflect.Method getMethod()
Returns theMethodfor theManagedFunction.- Returns:
Methodfor theManagedFunction.
-
execute
public void execute(ManagedFunctionContext<Indexed,Indexed> context) throws java.lang.Throwable
Description copied from interface:ManagedFunctionExecutes the function.- Specified by:
executein interfaceManagedFunction<Indexed,Indexed>- Parameters:
context-ManagedFunctionContextfor theManagedFunction.- Throws:
java.lang.Throwable- Indicating failure of theManagedFunction.
-
-