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

public final Class PropertySetExecutor

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

Specialized executor to set a property in an object.
Since
2.0

Field Summary

Modifier and TypeField and Description
private final String
property

The property.

private static final int
SET_START_INDEX

Index of the first character of the set{p,P}roperty.

Constructor Summary

AccessConstructor and Description
public
PropertySetExecutor(Introspector
the introspector
is
,
Class<?>
the class to introspect
clazz
,
String
the property to set
identifier
,
Object
the value to set into the property
arg
)

Creates an instance by attempting discovery of the set 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
,
String
the name of the property to set
property
,
Object
the value to assign to the property
arg
)

Discovers the method for a PropertySet.

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

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.
o
,
Object
The property to set in the object.
identifier
,
Object
The value to use as the property value.
arg
)

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 String property

The property.

SET_START_INDEXback to summary
private static final int SET_START_INDEX

Index of the first character of the set{p,P}roperty.

Constructor Detail

PropertySetExecutorback to summary
public PropertySetExecutor(Introspector is, Class<?> clazz, String identifier, Object arg)

Creates an instance by attempting discovery of the set method.

Parameters
is:Introspector

the introspector

clazz:Class<?>

the class to introspect

identifier:String

the property to set

arg:Object

the value to set into the property

Method Detail

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

Discovers the method for a PropertySet.

The method to be found should be named "set{P,p}property.

Parameters
is:Introspector

the introspector

clazz:Class<?>

the class to find the get method from

property:String

the name of the property to set

arg:Object

the value to assign to the property

Returns:Method

the method if found, null otherwise

executeback to summary
public Object execute(Object o, Object arg) 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
o:Object

The object to set the property in.

arg: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 o, Object identifier, Object arg)

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
o:Object

The object to invoke the method from.

identifier:Object

The property to set in the object.

arg:Object

The value to use as the property value.

Returns:Object

The return value or TRY_FAILED if checking failed.

Annotations
@Override