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

public abstract Class AbstractExecutor

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.jexl2.internal.AbstractExecutor.Get, org.apache.commons.jexl2.internal.AbstractExecutor.Set, org.apache.commons.jexl2.internal.AbstractExecutor.Method
Imports
org.apache.commons.jexl2.internal.introspection.MethodKey, org.apache.commons.jexl2.introspection.JexlMethod, .JexlPropertySet, .JexlPropertyGet, java.lang.reflect.InvocationTargetException

Abstract class that is used to execute an arbitrary method that is introspected. This is the superclass for all other AbstractExecutor classes.
Since
1.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
AbstractExecutor.Get

Abstract class that is used to execute an arbitrary 'get' method.

public abstract static class
AbstractExecutor.Method

Abstract class that is used to execute an arbitrary method.

public abstract static class
AbstractExecutor.Set

Abstract class that is used to execute an arbitrary 'set' method.

Field Summary

Modifier and TypeField and Description
protected final Method
method

Method to be executed.

protected final Class<?>
objectClass

The class this executor applies to.

public static final Object
TRY_FAILED

A marker for invocation failures in tryInvoke.

Constructor Summary

AccessConstructor and Description
protected
AbstractExecutor(Class<?>
the class this executor applies to
theClass
,
Method
the method held by this executor
theMethod
)

Default and sole constructor.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public boolean

Returns:

true if both executors are equivalent, false otherwise
equals
(AbstractExecutor
the other executor to check
arg
)

Indicates whether some other executor is equivalent to this one.

public final Method

Returns:

Method The method used by execute in derived classes.
getMethod
()

Gets the method to be executed or used as a marker.

public final String

Returns:

method name
getMethodName
()

Gets the method name used.

public final Class<?>

Returns:

the target object class
getTargetClass
()

Gets the object class targeted by this executor.

public Object

Returns:

the target property
getTargetProperty
()

Gets the property targeted by this executor.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
pack-priv static Method

Returns:

the method
initMarker
(Class<?>
the class to introspect
clazz
,
String
the name of the method
name
,
Class<?>...
the parameters
parms
)

A helper to initialize the marker methods (array.get, list.get, etc...).

public final boolean

Returns:

boolean Whether the executor is alive.
isAlive
()

Tell whether the executor is alive by looking at the value of the method.

public boolean

Returns:

true if can be reused for this class, false if not
isCacheable
()

Specifies if this executor is cacheable and able to be reused for this class of object it was returned for.

pack-priv static Object[]

Returns:

the arguments array
makeArgs
(Object...
the list of arguments
args
)

Creates an arguments array.

public final boolean

Returns:

true if tryExecute failed, false otherwise
tryFailed
(Object
the value returned by tryExecute
exec
)

Checks whether a tryExecute failed or not.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

methodback to summary
protected final Method method

Method to be executed.

objectClassback to summary
protected final Class<?> objectClass

The class this executor applies to.

TRY_FAILEDback to summary
public static final Object TRY_FAILED

A marker for invocation failures in tryInvoke.

Constructor Detail

AbstractExecutorback to summary
protected AbstractExecutor(Class<?> theClass, Method theMethod)

Default and sole constructor.

Parameters
theClass:Class<?>

the class this executor applies to

theMethod:Method

the method held by this executor

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
equalsback to summary
public boolean equals(AbstractExecutor arg)

Indicates whether some other executor is equivalent to this one.

Parameters
arg:AbstractExecutor

the other executor to check

Returns:boolean

true if both executors are equivalent, false otherwise

getMethodback to summary
public final Method getMethod()

Gets the method to be executed or used as a marker.

Returns:Method

Method The method used by execute in derived classes.

getMethodNameback to summary
public final String getMethodName()

Gets the method name used.

Returns:String

method name

getTargetClassback to summary
public final Class<?> getTargetClass()

Gets the object class targeted by this executor.

Returns:Class<?>

the target object class

getTargetPropertyback to summary
public Object getTargetProperty()

Gets the property targeted by this executor.

Returns:Object

the target property

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
initMarkerback to summary
pack-priv static Method initMarker(Class<?> clazz, String name, Class<?>... parms)

A helper to initialize the marker methods (array.get, list.get, etc...).

Parameters
clazz:Class<?>

the class to introspect

name:String

the name of the method

parms:Class<?>[]

the parameters

Returns:Method

the method

isAliveback to summary
public final boolean isAlive()

Tell whether the executor is alive by looking at the value of the method.

Returns:boolean

boolean Whether the executor is alive.

isCacheableback to summary
public boolean isCacheable()

Specifies if this executor is cacheable and able to be reused for this class of object it was returned for.

Returns:boolean

true if can be reused for this class, false if not

makeArgsback to summary
pack-priv static Object[] makeArgs(Object... args)

Creates an arguments array.

Parameters
args:Object[]

the list of arguments

Returns:Object[]

the arguments array

tryFailedback to summary
public final boolean tryFailed(Object exec)

Checks whether a tryExecute failed or not.

Parameters
exec:Object

the value returned by tryExecute

Returns:boolean

true if tryExecute failed, false otherwise

org.apache.commons.jexl2.internal back to summary

public abstract Class AbstractExecutor.Get

extends AbstractExecutor
implements JexlPropertyGet
Class Inheritance
All Implemented Interfaces
org.apache.commons.jexl2.introspection.JexlPropertyGet
Known Direct Subclasses
org.apache.commons.jexl2.internal.BooleanGetExecutor, org.apache.commons.jexl2.internal.DuckGetExecutor, org.apache.commons.jexl2.internal.ListGetExecutor, org.apache.commons.jexl2.internal.MapGetExecutor, org.apache.commons.jexl2.internal.PropertyGetExecutor

Abstract class that is used to execute an arbitrary 'get' method.

Field Summary

Inherited from org.apache.commons.jexl2.internal.AbstractExecutor:
methodobjectClassTRY_FAILED

Constructor Summary

AccessConstructor and Description
protected
Get(Class<?>
the class this executor applies to
theClass
,
Method
the method held by this executor
theMethod
)

Default and sole constructor.

Method Summary

Modifier and TypeMethod and Description
public abstract Object

Returns:

The property value.
execute
(Object
The object to get the property from.
obj
)

Gets the property value from an object.

public final Object
invoke(Object
the object to get the property value from.
obj
)

Implements org.apache.commons.jexl2.introspection.JexlPropertyGet.invoke.

Method used to get the property value of an object.
public Object

Returns:

The property value or TRY_FAILED if checking failed.
tryExecute
(Object
The object to get the property from.
obj
,
Object
The property to get from the object.
key
)

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

public final Object
tryInvoke(Object
the object to invoke the property get upon
obj
,
Object
the property key to get
key
)

Implements org.apache.commons.jexl2.introspection.JexlPropertyGet.tryInvoke.

Attempts to reuse this JexlPropertyGet, checking that it is compatible with the actual set of arguments.
Inherited from org.apache.commons.jexl2.internal.AbstractExecutor:
equalsequalsgetMethodgetMethodNamegetTargetClassgetTargetPropertyhashCodeinitMarkerisAliveisCacheablemakeArgstryFailed

Constructor Detail

Getback to summary
protected Get(Class<?> theClass, Method theMethod)

Default and sole constructor.

Parameters
theClass:Class<?>

the class this executor applies to

theMethod:Method

the method held by this executor

Method Detail

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

Gets the property value from an object.

Parameters
obj:Object

The object to get the property from.

Returns:Object

The property value.

Exceptions
IllegalAccessException:
Method is inaccessible.
InvocationTargetException:
Method body throws an exception.
invokeback to summary
public final Object invoke(Object obj) throws Exception

Implements org.apache.commons.jexl2.introspection.JexlPropertyGet.invoke.

Doc from org.apache.commons.jexl2.introspection.JexlPropertyGet.invoke.

Method used to get the property value of an object.

Parameters
obj:Object

the object to get the property value from.

Returns:Object

the property value.

Exceptions
Exception:
on any error.
tryExecuteback to summary
public Object tryExecute(Object obj, Object key)

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.

tryInvokeback to summary
public final Object tryInvoke(Object obj, Object key)

Implements org.apache.commons.jexl2.introspection.JexlPropertyGet.tryInvoke.

Doc from org.apache.commons.jexl2.introspection.JexlPropertyGet.tryInvoke.

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

Parameters
obj:Object

the object to invoke the property get upon

key:Object

the property key to get

Returns:Object

the result of the method invocation that should be checked by tryFailed to determine if it succeeded or failed.

org.apache.commons.jexl2.internal back to summary

public abstract Class AbstractExecutor.Method

extends AbstractExecutor
implements JexlMethod
Class Inheritance
All Implemented Interfaces
org.apache.commons.jexl2.introspection.JexlMethod
Known Direct Subclasses
org.apache.commons.jexl2.internal.MethodExecutor

Abstract class that is used to execute an arbitrary method.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
AbstractExecutor.Method.Parameter

A helper class to pass the method & parameters.

Field Summary

Modifier and TypeField and Description
protected final MethodKey
key

The method key discovered from the arguments.

Inherited from org.apache.commons.jexl2.internal.AbstractExecutor:
methodobjectClassTRY_FAILED

Constructor Summary

AccessConstructor and Description
protected
Method(Class<?>
the class this executor applies to
c
,
AbstractExecutor.Method.Parameter
the method and MethodKey to encapsulate.
km
)

Creates a new instance.

Method Summary

Modifier and TypeMethod and Description
public abstract Object

Returns:

the result of the method invocation
execute
(Object
the object to invoke the method upon
obj
,
Object[]
the method arguments
args
)

Invokes the method to be executed.

public final Class<?>

Returns:

return type
getReturnType
()

Implements org.apache.commons.jexl2.introspection.JexlMethod.getReturnType.

Returns the return type of the method invoked.
public Object
getTargetProperty()

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

Gets the property targeted by this executor.
public final Object
invoke(Object
the object
obj
,
Object[]
method parameters.
params
)

Implements org.apache.commons.jexl2.introspection.JexlMethod.invoke.

Invocation method, called when the method invocation should be performed and a value returned.
public Object

Returns:

the result of the method invocation or TRY_FAILED if checking failed.
tryExecute
(String
the method name
name
,
Object
the object to invoke the method upon
obj
,
Object[]
the method arguments
args
)

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

public final Object
tryInvoke(String
the method name
name
,
Object
the object to invoke the method upon
obj
,
Object[]
the method arguments
params
)

Implements org.apache.commons.jexl2.introspection.JexlMethod.tryInvoke.

Attempts to reuse this JexlMethod, checking that it is compatible with the actual set of arguments.
Inherited from org.apache.commons.jexl2.internal.AbstractExecutor:
equalsequalsgetMethodgetMethodNamegetTargetClasshashCodeinitMarkerisAliveisCacheablemakeArgstryFailed

Field Detail

keyback to summary
protected final MethodKey key

The method key discovered from the arguments.

Constructor Detail

Methodback to summary
protected Method(Class<?> c, AbstractExecutor.Method.Parameter km)

Creates a new instance.

Parameters
c:Class<?>

the class this executor applies to

km:AbstractExecutor.Method.Parameter

the method and MethodKey to encapsulate.

Method Detail

executeback to summary
public abstract Object execute(Object obj, Object[] args) throws IllegalAccessException, InvocationTargetException

Invokes the method to be executed.

Parameters
obj:Object

the object to invoke the method upon

args:Object[]

the method arguments

Returns:Object

the result of the method invocation

Exceptions
IllegalAccessException:
Method is inaccessible.
InvocationTargetException:
Method body throws an exception.
getReturnTypeback to summary
public final Class<?> getReturnType()

Implements org.apache.commons.jexl2.introspection.JexlMethod.getReturnType.

Returns the return type of the method invoked.

Returns:Class<?>

return type

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
invokeback to summary
public final Object invoke(Object obj, Object[] params) throws Exception

Implements org.apache.commons.jexl2.introspection.JexlMethod.invoke.

Doc from org.apache.commons.jexl2.introspection.JexlMethod.invoke.

Invocation method, called when the method invocation should be performed and a value returned.

Parameters
obj:Object

the object

params:Object[]

method parameters.

Returns:Object

the result

Exceptions
Exception:
on any error.
tryExecuteback to summary
public Object tryExecute(String name, Object obj, Object[] args)

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

Parameters
name:String

the method name

obj:Object

the object to invoke the method upon

args:Object[]

the method arguments

Returns:Object

the result of the method invocation or TRY_FAILED if checking failed.

tryInvokeback to summary
public final Object tryInvoke(String name, Object obj, Object[] params)

Implements org.apache.commons.jexl2.introspection.JexlMethod.tryInvoke.

Doc from org.apache.commons.jexl2.introspection.JexlMethod.tryInvoke.

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.

Parameters
name:String

the method name

obj:Object

the object to invoke the method upon

params:Object[]

the method arguments

Returns:Object

the result of the method invocation that should be checked by tryFailed to determine if it succeeded or failed.

org.apache.commons.jexl2.internal back to summary

protected final Class AbstractExecutor.Method.Parameter

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.commons.jexl2.internal.AbstractExecutor.Method.Parameter

A helper class to pass the method & parameters.

Field Summary

Modifier and TypeField and Description
private final MethodKey
key

The method key.

private final Method
method

The method.

Constructor Summary

AccessConstructor and Description
public
Parameter(Method
the method
m
,
MethodKey
the method key
k
)

Creates an instance.

Field Detail

keyback to summary
private final MethodKey key

The method key.

methodback to summary
private final Method method

The method.

Constructor Detail

Parameterback to summary
public Parameter(Method m, MethodKey k)

Creates an instance.

Parameters
m:Method

the method

k:MethodKey

the method key

org.apache.commons.jexl2.internal back to summary

public abstract Class AbstractExecutor.Set

extends AbstractExecutor
implements JexlPropertySet
Class Inheritance
All Implemented Interfaces
org.apache.commons.jexl2.introspection.JexlPropertySet
Known Direct Subclasses
org.apache.commons.jexl2.internal.DuckSetExecutor, org.apache.commons.jexl2.internal.ListSetExecutor, org.apache.commons.jexl2.internal.MapSetExecutor, org.apache.commons.jexl2.internal.PropertySetExecutor

Abstract class that is used to execute an arbitrary 'set' method.

Field Summary

Inherited from org.apache.commons.jexl2.internal.AbstractExecutor:
methodobjectClassTRY_FAILED

Constructor Summary

AccessConstructor and Description
protected
Set(Class<?>
the class this executor applies to
theClass
,
Method
the method held by this executor
theMethod
)

Default and sole constructor.

Method Summary

Modifier and TypeMethod and Description
public abstract Object

Returns:

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

Sets the property value of an object.

public final Object
invoke(Object
Object on which the property setter will be called with the value
obj
,
Object
value to be set
arg
)

Implements org.apache.commons.jexl2.introspection.JexlPropertySet.invoke.

Method used to set the property value of an object.
public Object

Returns:

The return value or TRY_FAILED if checking failed.
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
)

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

public final Object
tryInvoke(Object
the object to invoke the the get upon
obj
,
Object
the property key to get
key
,
Object
the property value to set
value
)

Implements org.apache.commons.jexl2.introspection.JexlPropertySet.tryInvoke.

Attempts to reuse this JexlPropertySet, checking that it is compatible with the actual set of arguments.
Inherited from org.apache.commons.jexl2.internal.AbstractExecutor:
equalsequalsgetMethodgetMethodNamegetTargetClassgetTargetPropertyhashCodeinitMarkerisAliveisCacheablemakeArgstryFailed

Constructor Detail

Setback to summary
protected Set(Class<?> theClass, Method theMethod)

Default and sole constructor.

Parameters
theClass:Class<?>

the class this executor applies to

theMethod:Method

the method held by this executor

Method Detail

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

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.

Exceptions
IllegalAccessException:
Method is inaccessible.
InvocationTargetException:
Method body throws an exception.
invokeback to summary
public final Object invoke(Object obj, Object arg) throws Exception

Implements org.apache.commons.jexl2.introspection.JexlPropertySet.invoke.

Doc from org.apache.commons.jexl2.introspection.JexlPropertySet.invoke.

Method used to set the property value of an object.

Parameters
obj:Object

Object on which the property setter will be called with the value

arg:Object

value to be set

Returns:Object

the value returned from the set operation (impl specific)

Exceptions
Exception:
on any error.
tryExecuteback to summary
public Object tryExecute(Object obj, Object key, Object value)

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.

tryInvokeback to summary
public final Object tryInvoke(Object obj, Object key, Object value)

Implements org.apache.commons.jexl2.introspection.JexlPropertySet.tryInvoke.

Doc from org.apache.commons.jexl2.introspection.JexlPropertySet.tryInvoke.

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

Parameters
obj:Object

the object to invoke the the get upon

key:Object

the property key to get

value:Object

the property value to set

Returns:Object

the result of the method invocation that should be checked by tryFailed to determine if it succeeded or failed.