java.lang.Object
edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.AbstractExecutor
edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.AbstractExecutor.Method
All Implemented Interfaces:
JexlMethod
Direct Known Subclasses:
MethodExecutor
Enclosing class:
AbstractExecutor

public abstract static class AbstractExecutor.Method extends AbstractExecutor implements JexlMethod
Abstract class that is used to execute an arbitrary method.
  • Field Details

    • key

      protected final MethodKey key
      The method key discovered from the arguments.
  • Constructor Details

    • Method

      protected Method(Class<?> c, AbstractExecutor.Method.Parameter km)
      Creates a new instance.
      Parameters:
      c - the class this executor applies to
      km - the method and MethodKey to encapsulate.
  • Method Details

    • invoke

      public final Object invoke(Object obj, Object[] params) throws Exception
      Invocation method, called when the method invocation should be performed and a value returned.
      Specified by:
      invoke in interface JexlMethod
      Parameters:
      obj - the object
      params - method parameters.
      Returns:
      the result
      Throws:
      Exception - on any error.
    • tryInvoke

      public final Object tryInvoke(String name, Object obj, Object[] params)
      Attempts to reuse this JexlMethod, checking that it is compatible with the actual set of arguments. Related to isCacheable since this method is often used with cached JexlMethod instances.
      Specified by:
      tryInvoke in interface JexlMethod
      Parameters:
      name - the method name
      obj - the object to invoke the method upon
      params - the method arguments
      Returns:
      the result of the method invocation that should be checked by tryFailed to determine if it succeeded or failed.
    • getTargetProperty

      public Object getTargetProperty()
      Gets the property targeted by this executor.
      Overrides:
      getTargetProperty in class AbstractExecutor
      Returns:
      the target property
    • getReturnType

      public final Class<?> getReturnType()
      Returns the return type of the method invoked.
      Specified by:
      getReturnType in interface JexlMethod
      Returns:
      return type
    • execute

      public abstract Object execute(Object obj, Object[] args) throws IllegalAccessException, InvocationTargetException
      Invokes the method to be executed.
      Parameters:
      obj - the object to invoke the method upon
      args - the method arguments
      Returns:
      the result of the method invocation
      Throws:
      IllegalAccessException - Method is inaccessible.
      InvocationTargetException - Method body throws an exception.
    • tryExecute

      public Object tryExecute(String name, Object obj, Object[] args)
      Tries to reuse this executor, checking that it is compatible with the actual set of arguments.
      Parameters:
      obj - the object to invoke the method upon
      name - the method name
      args - the method arguments
      Returns:
      the result of the method invocation or TRY_FAILED if checking failed.