Class MethodExecutor
java.lang.Object
edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.AbstractExecutor
edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.AbstractExecutor.Method
edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.MethodExecutor
- All Implemented Interfaces:
JexlMethod
Specialized executor to invoke a method on an object.
- Since:
- 2.0
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.AbstractExecutor.Method
AbstractExecutor.Method.Parameter
Nested classes/interfaces inherited from class edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.AbstractExecutor
AbstractExecutor.Get, AbstractExecutor.Method, AbstractExecutor.Set
-
Field Summary
Fields inherited from class edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.AbstractExecutor.Method
key
Fields inherited from class edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.AbstractExecutor
method, objectClass, TRY_FAILED
-
Constructor Summary
ConstructorDescriptionMethodExecutor
(Introspector is, Object obj, String name, Object[] args) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionInvokes the method to be executed.protected Object[]
handleVarArg
(Class<?> type, int index, Object[] actual) Reassembles arguments if the method is a vararg method.tryExecute
(String name, Object obj, Object[] args) Tries to reuse this executor, checking that it is compatible with the actual set of arguments.Methods inherited from class edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.AbstractExecutor.Method
getReturnType, getTargetProperty, invoke, tryInvoke
Methods inherited from class edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.AbstractExecutor
equals, equals, getMethod, getMethodName, getTargetClass, hashCode, isAlive, isCacheable, tryFailed
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.introspection.JexlMethod
isCacheable, tryFailed
-
Constructor Details
-
MethodExecutor
Creates a new instance.- Parameters:
is
- the introspector used to discover the methodobj
- the object to find the method inname
- the method nameargs
- the method arguments
-
-
Method Details
-
execute
public Object execute(Object o, Object[] args) throws IllegalAccessException, InvocationTargetException Invokes the method to be executed.- Specified by:
execute
in classAbstractExecutor.Method
- Parameters:
o
- the object to invoke the method uponargs
- the method arguments- Returns:
- the result of the method invocation
- Throws:
IllegalAccessException
- Method is inaccessible.InvocationTargetException
- Method body throws an exception.
-
tryExecute
Tries to reuse this executor, checking that it is compatible with the actual set of arguments.- Overrides:
tryExecute
in classAbstractExecutor.Method
- Parameters:
name
- the method nameobj
- the object to invoke the method uponargs
- the method arguments- Returns:
- the result of the method invocation or TRY_FAILED if checking failed.
-
handleVarArg
Reassembles arguments if the method is a vararg method.- Parameters:
type
- The vararg class type (aka component type of the expected array arg)index
- The index of the vararg in the method declaration (This will always be one less than the number of expected arguments.)actual
- The actual parameters being passed to this method- Returns:
- The actual parameters adjusted for the varargs in order to fit the method declaration.
-