AbstractExecutor.Method (Commons JEXL 2.0.1 API)
Keywords: org.apache.commons.jexl2.internal.AbstractExecutor.Method class

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 AbstractExecutor.Method

    java.lang.Object
      org.apache.commons.jexl2.internal.AbstractExecutor
          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.

Nested Class Summary
`protected static class` | `AbstractExecutor.Method.Parameter` A helper class to pass the method & parameters.

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

Field Summary
`protected MethodKey` | `key` The method key discovered from the arguments.

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

Constructor Summary
`protected` | `AbstractExecutor.Method(java.lang.Class<?> c, AbstractExecutor.Method.Parameter km)` Creates a new instance.

Method Summary
`abstract java.lang.Object` | `execute(java.lang.Object obj, java.lang.Object[] args)` Invokes the method to be executed.
`java.lang.Class<?>` | `getReturnType()` Returns the return type of the method invoked.
`java.lang.Object` | `getTargetProperty()` Gets the property targeted by this executor.
`java.lang.Object` | `invoke(java.lang.Object obj, java.lang.Object[] params)` Invocation method, called when the method invocation should be performed and a value returned.
`java.lang.Object` | `tryExecute(java.lang.String name, java.lang.Object obj, java.lang.Object[] args)` Tries to reuse this executor, checking that it is compatible with the actual set of arguments.
`java.lang.Object` | `tryInvoke(java.lang.String name, java.lang.Object obj, java.lang.Object[] params)` Attempts to reuse this JexlMethod, checking that it is compatible with the actual set of arguments.

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`

Field Detail

### key

    protected final MethodKey key

  The method key discovered from the arguments.

Constructor Detail

### AbstractExecutor.Method

    protected AbstractExecutor.Method(java.lang.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 Detail

### invoke

    public final java.lang.Object invoke(java.lang.Object obj,
                                         java.lang.Object[] params)
                                  throws java.lang.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:
    `java.lang.Exception` - on any error.

### tryInvoke

    public final java.lang.Object tryInvoke(java.lang.String name,
                                            java.lang.Object obj,
                                            java.lang.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 java.lang.Object getTargetProperty()

  Gets the property targeted by this executor.

  Overrides:
    `getTargetProperty` in class `AbstractExecutor`
  Returns:
    the target property

### getReturnType

    public final java.lang.Class<?> getReturnType()

  Returns the return type of the method invoked.

  Specified by:
    `getReturnType` in interface `JexlMethod`
  Returns:
    return type

### execute

    public abstract java.lang.Object execute(java.lang.Object obj,
                                             java.lang.Object[] args)
                                      throws java.lang.IllegalAccessException,
                                             java.lang.reflect.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:
    `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 obj,
                                       java.lang.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.

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.