Class CustomOperationWrapper
- java.lang.Object
-
- de.gebit.integrity.operations.custom.CustomOperationWrapper
-
public class CustomOperationWrapper extends Object
The custom operation wrapper is used to wrap a custom operation class and instance for execution. The wrapper does perform class loading and instantiation.- Author:
- Rene Schneider - initial API and implementation
-
-
Constructor Summary
Constructors Constructor Description CustomOperationWrapper(CustomOperation anOperation, com.google.inject.Injector anInjector)Creates a new wrapper instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MethoddetermineExecuteMethod()Searches the operation class for the "execute" method, and returns the corresponding reflection method instance.protected Class<?>determinePostfixParameterTargetType()Determines the type of the operation postfix parameter.protected Class<?>determinePrefixParameterTargetType()Determines the type of the operation prefix parameter.ObjectexecuteOperation()Executes the wrapped operation logic.
-
-
-
Constructor Detail
-
CustomOperationWrapper
public CustomOperationWrapper(CustomOperation anOperation, com.google.inject.Injector anInjector) throws ClassNotFoundException
Creates a new wrapper instance. This also loads the actual operation implementation class using the injected classloader.- Parameters:
anOperation- the operation to wrapanInjector- the Guice injector (can't wait to inject it because we require stuff injected during construction)- Throws:
ClassNotFoundException- if the operations' class could not be found
-
-
Method Detail
-
executeOperation
public Object executeOperation() throws UnexecutableException
Executes the wrapped operation logic.- Returns:
- the result of the operation
- Throws:
UnexecutableException- if the operation cannot be executed for any reason
-
determinePrefixParameterTargetType
protected Class<?> determinePrefixParameterTargetType()
Determines the type of the operation prefix parameter.- Returns:
- the expected type
-
determinePostfixParameterTargetType
protected Class<?> determinePostfixParameterTargetType()
Determines the type of the operation postfix parameter.- Returns:
- the expected type
-
determineExecuteMethod
protected Method determineExecuteMethod()
Searches the operation class for the "execute" method, and returns the corresponding reflection method instance.- Returns:
- the method representation
-
-