Class DefaultExecutionStrategy

  • All Implemented Interfaces:
    ExecutionStrategy

    public class DefaultExecutionStrategy
    extends java.lang.Object
    implements ExecutionStrategy
    The default ExecutionStrategy implementation.
    • class implements `Supplier`: the `get()` method is called
    • class implements `Runnable`: the `run()` method is called
    • class has exactly one public method without arguments: call it
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Class<?> clazz  
      private java.lang.reflect.Method method  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object execute​(java.lang.Object instance)
      Executes a method on an object instance, or a static method if the specified instance is null.
      private static java.lang.reflect.Method findCallableMethod​(java.lang.Class<?> clazz)  
      • Methods inherited from class java.lang.Object

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

      • clazz

        private final java.lang.Class<?> clazz
      • method

        private final java.lang.reflect.Method method
    • Constructor Detail

      • DefaultExecutionStrategy

        public DefaultExecutionStrategy​(java.lang.Class<?> clazz)
        Constructs a DefaultExecutionStrategy for the specified Class.
        Parameters:
        clazz - the Class
    • Method Detail

      • execute

        public java.lang.Object execute​(java.lang.Object instance)
                                 throws javax.script.ScriptException
        Description copied from interface: ExecutionStrategy
        Executes a method on an object instance, or a static method if the specified instance is null.
        Specified by:
        execute in interface ExecutionStrategy
        Parameters:
        instance - the object instance to be executed or null to execute a static method
        Returns:
        the return value of the method, or null
        Throws:
        javax.script.ScriptException - if no method to execute was found
      • findCallableMethod

        private static java.lang.reflect.Method findCallableMethod​(java.lang.Class<?> clazz)