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

public final Class DuckSetExecutor

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

Specialized executor to set a property of an object.

Duck as in duck-typing for an interface like: interface Set { Object set(Object property, Object value); }

Since
2.0

Field Summary

Modifier and TypeField and Description
private final Object
property

The property.

Constructor Summary

AccessConstructor and Description
public
DuckSetExecutor(Introspector
the introspector
is
,
Class<?>
the class to find the set method from
clazz
,
Object
the key to use as 1st argument to the set method
key
,
Object
the value to use as 2nd argument to the set method
value
)

Creates an instance.

Method Summary

Modifier and TypeMethod and Description
private static Method

Returns:

the method if found, null otherwise
discover
(Introspector
the introspector
is
,
Class<?>
the class to find the set method from
clazz
,
Object
the key to use as 1st argument to the set method
key
,
Object
the value to use as 2nd argument to the set method
value
)

Discovers the method for a DuckSet.

public Object
execute(Object
The object to set the property in.
obj
,
Object
The value.
value
)

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

Sets the property value of an 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 invoke the method from.
obj
,
Object
The property to set in the object.
key
,
Object
The value to use as the property value.
value
)

Overrides org.apache.commons.jexl2.internal.AbstractExecutor.Set.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.Set:
invoketryInvoke

Field Detail

propertyback to summary
private final Object property

The property.

Constructor Detail

DuckSetExecutorback to summary
public DuckSetExecutor(Introspector is, Class<?> clazz, Object key, Object value)

Creates an instance.

Parameters
is:Introspector

the introspector

clazz:Class<?>

the class to find the set method from

key:Object

the key to use as 1st argument to the set method

value:Object

the value to use as 2nd argument to the set method

Method Detail

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

Discovers the method for a DuckSet.

Parameters
is:Introspector

the introspector

clazz:Class<?>

the class to find the set method from

key:Object

the key to use as 1st argument to the set method

value:Object

the value to use as 2nd argument to the set method

Returns:Method

the method if found, null otherwise

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

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

Doc from org.apache.commons.jexl2.internal.AbstractExecutor.Set.execute.

Sets the property value of an object.

Parameters
obj:Object

The object to set the property in.

value:Object

The value.

Returns:Object

The return value.

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, Object value)

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

Doc from org.apache.commons.jexl2.internal.AbstractExecutor.Set.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, 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) and that arg must be a valid argument for this executor underlying method.

Parameters
obj:Object

The object to invoke the method from.

key:Object

The property to set in the object.

value:Object

The value to use as the property value.

Returns:Object

The return value or TRY_FAILED if checking failed.

Annotations
@Override