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>
ManagedFunction
to 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 void
execute(ManagedFunctionContext<Indexed,Indexed> context)
Executes the function.java.lang.reflect.Method
getMethod()
Returns theMethod
for theManagedFunction
.static java.lang.Object
invokeMethod(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 benull
if staticMethod
.method
- Method to invoke for thisManagedFunction
.parameterFactories
-ClassDependencyFactory
instances.returnTranslator
-MethodReturnTranslator
ornull
.
-
-
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 benull
if staticMethod
.method
-Method
.parameters
- Parameters.- Returns:
Method
return value.- Throws:
java.lang.Throwable
- Failure invoking theMethod
.
-
getMethod
public java.lang.reflect.Method getMethod()
Returns theMethod
for theManagedFunction
.- Returns:
Method
for theManagedFunction
.
-
execute
public void execute(ManagedFunctionContext<Indexed,Indexed> context) throws java.lang.Throwable
Description copied from interface:ManagedFunction
Executes the function.- Specified by:
execute
in interfaceManagedFunction<Indexed,Indexed>
- Parameters:
context
-ManagedFunctionContext
for theManagedFunction
.- Throws:
java.lang.Throwable
- Indicating failure of theManagedFunction
.
-
-