Top Description Fields Constructors Methods
org.apache.commons.jexl2.internal

public final Class DuckGetExecutor

extends Get
Class Inheritance
Imports
java.lang.reflect.InvocationTargetException

Specialized executor to get a property from an object.

Duck as in duck-typing for an interface like: interface Get { Object get(Object key); }

Since
2.0

Field Summary

Modifier and TypeField and Description
private final Object
property

The property.

Constructor Summary

AccessConstructor and Description
public
DuckGetExecutor(Introspector
the introspector
is
,
Class<?>
the class to introspect
clazz
,
Object
the property to get
identifier
)

Creates an instance by attempting discovery of the get method.

Method Summary

Modifier and TypeMethod and Description
private static Method

Returns:

the method if found, null otherwise
discover
(Introspector
the introspector
is
,
final Class<?>
the class to find the get method from
clazz
,
Object
the key to use as an argument to the get method
identifier
)

Discovers a method for a GetExecutor.DuckGet.

public Object

Returns:

object.get(property)
execute
(Object
the object.
obj
)

Implements abstract org.apache.commons.jexl2.internal.AbstractExecutor.Get.execute.

Get the property from the object.
public Object
getTargetProperty()

Overrides org.apache.commons.jexl2.internal.AbstractExecutor.getTargetProperty.

Gets the property targeted by this executor.
public Object
tryExecute(Object
The object to get the property from.
obj
,
Object
The property to get from the object.
key
)

Overrides org.apache.commons.jexl2.internal.AbstractExecutor.Get.tryExecute.

Tries to reuse this executor, checking that it is compatible with the actual set of arguments.
Inherited from org.apache.commons.jexl2.internal.AbstractExecutor.Get:
invoketryInvoke

Field Detail

propertyback to summary
private final Object property

The property.

Constructor Detail

DuckGetExecutorback to summary
public DuckGetExecutor(Introspector is, Class<?> clazz, Object identifier)

Creates an instance by attempting discovery of the get method.

Parameters
is:Introspector

the introspector

clazz:Class<?>

the class to introspect

identifier:Object

the property to get

Method Detail

discoverback to summary
private static Method discover(Introspector is, final Class<?> clazz, Object identifier)

Discovers a method for a GetExecutor.DuckGet.

Parameters
is:Introspector

the introspector

clazz:Class<?>

the class to find the get method from

identifier:Object

the key to use as an argument to the get method

Returns:Method

the method if found, null otherwise

executeback to summary
public Object execute(Object obj) throws IllegalAccessException, InvocationTargetException

Implements abstract org.apache.commons.jexl2.internal.AbstractExecutor.Get.execute.

Get the property from the object.

Parameters
obj:Object

the object.

Returns:Object

object.get(property)

Annotations
@Override
Exceptions
IllegalAccessException:
Method is inaccessible.
InvocationTargetException:
Method body throws an exception.
getTargetPropertyback to summary
public Object getTargetProperty()

Overrides org.apache.commons.jexl2.internal.AbstractExecutor.getTargetProperty.

Doc from org.apache.commons.jexl2.internal.AbstractExecutor.getTargetProperty.

Gets the property targeted by this executor.

Returns:Object

the target property

Annotations
@Override
tryExecuteback to summary
public Object tryExecute(Object obj, Object key)

Overrides org.apache.commons.jexl2.internal.AbstractExecutor.Get.tryExecute.

Doc from org.apache.commons.jexl2.internal.AbstractExecutor.Get.tryExecute.

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

Compatibility means that: o must be of the same class as this executor's target class and property must be of the same class as this executor's target property (for list and map based executors) and have the same value (for other types).

Parameters
obj:Object

The object to get the property from.

key:Object

The property to get from the object.

Returns:Object

The property value or TRY_FAILED if checking failed.

Annotations
@Override