Class 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 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 wrap
        anInjector - 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