Class CustomOperationWrapper


  • public class CustomOperationWrapper
    extends java.lang.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.reflect.Method determineExecuteMethod()
      Searches the operation class for the "execute" method, and returns the corresponding reflection method instance.
      protected java.lang.Class<?> determinePostfixParameterTargetType()
      Determines the type of the operation postfix parameter.
      protected java.lang.Class<?> determinePrefixParameterTargetType()
      Determines the type of the operation prefix parameter.
      java.lang.Object executeOperation()
      Executes the wrapped operation logic.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CustomOperationWrapper

        public CustomOperationWrapper​(CustomOperation anOperation,
                                      com.google.inject.Injector anInjector)
                               throws java.lang.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:
        java.lang.ClassNotFoundException - if the operations' class could not be found
    • Method Detail

      • executeOperation

        public java.lang.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 java.lang.Class<?> determinePrefixParameterTargetType()
        Determines the type of the operation prefix parameter.
        Returns:
        the expected type
      • determinePostfixParameterTargetType

        protected java.lang.Class<?> determinePostfixParameterTargetType()
        Determines the type of the operation postfix parameter.
        Returns:
        the expected type
      • determineExecuteMethod

        protected java.lang.reflect.Method determineExecuteMethod()
        Searches the operation class for the "execute" method, and returns the corresponding reflection method instance.
        Returns:
        the method representation