Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.jexl2.internal
Class MethodExecutor

    java.lang.Object
      org.apache.commons.jexl2.internal.AbstractExecutor
          org.apache.commons.jexl2.internal.AbstractExecutor.Method
              org.apache.commons.jexl2.internal.MethodExecutor

All Implemented Interfaces:
  JexlMethod

    public final class MethodExecutor

extends AbstractExecutor.Method

Specialized executor to invoke a method on an object.

Since:
  2.0

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.commons.jexl2.internal.AbstractExecutor.Method
`AbstractExecutor.Method.Parameter`

Nested classes/interfaces inherited from class org.apache.commons.jexl2.internal.AbstractExecutor
`AbstractExecutor.Get, AbstractExecutor.Method, AbstractExecutor.Set`

Field Summary

Fields inherited from class org.apache.commons.jexl2.internal.AbstractExecutor.Method
`key`

Fields inherited from class org.apache.commons.jexl2.internal.AbstractExecutor
`method, objectClass, TRY_FAILED`

Constructor Summary
`MethodExecutor(Introspector is, java.lang.Object obj, java.lang.String name, java.lang.Object[] args)` Creates a new instance.

Method Summary
`java.lang.Object` | `execute(java.lang.Object o, java.lang.Object[] args)` Invokes the method to be executed.
`protected java.lang.Object[]` | `handleVarArg(java.lang.Class<?> type, int index, java.lang.Object[] actual)` Reassembles arguments if the method is a vararg method.
`java.lang.Object` | `tryExecute(java.lang.String name, java.lang.Object o, java.lang.Object[] args)` Tries to reuse this executor, checking that it is compatible with the actual set of arguments.

Methods inherited from class org.apache.commons.jexl2.internal.AbstractExecutor.Method
`getReturnType, getTargetProperty, invoke, tryInvoke`

Methods inherited from class 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 org.apache.commons.jexl2.introspection.JexlMethod
`isCacheable, tryFailed`

Constructor Detail

### MethodExecutor

    public MethodExecutor(Introspector is,
                          java.lang.Object obj,
                          java.lang.String name,
                          java.lang.Object[] args)

  Creates a new instance.

  Parameters:
    `is` - the introspector used to discover the method
    `obj` - the object to find the method in
    `name` - the method name
    `args` - the method arguments

Method Detail

### execute

    public java.lang.Object execute(java.lang.Object o,
                                    java.lang.Object[] args)
                             throws java.lang.IllegalAccessException,
                                    java.lang.reflect.InvocationTargetException

  Invokes the method to be executed.

  Specified by:
    `execute` in class `AbstractExecutor.Method`
  Parameters:
    `o` - the object to invoke the method upon
    `args` - the method arguments
  Returns:
    the result of the method invocation
  Throws:
    `java.lang.IllegalAccessException` - Method is inaccessible.
    `java.lang.reflect.InvocationTargetException` - Method body throws an exception.

### tryExecute

    public java.lang.Object tryExecute(java.lang.String name,
                                       java.lang.Object o,
                                       java.lang.Object[] args)

  Tries to reuse this executor, checking that it is compatible with the actual set of arguments.

  Overrides:
    `tryExecute` in class `AbstractExecutor.Method`
  Parameters:
    `name` - the method name
    `o` - the object to invoke the method upon
    `args` - the method arguments
  Returns:
    the result of the method invocation or TRY_FAILED if checking failed.

### handleVarArg

    protected java.lang.Object[] handleVarArg(java.lang.Class<?> type,
                                              int index,
                                              java.lang.Object[] actual)

  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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.