Class AbstractExecutor
java.lang.Object
org.apache.commons.jexl3.internal.introspection.AbstractExecutor
- Direct Known Subclasses:
AbstractExecutor.Get
,AbstractExecutor.Method
,AbstractExecutor.Set
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 Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Abstract class that is used to execute an arbitrary 'get' method.static class
Abstract class that is used to execute an arbitrary method.static class
Abstract class that is used to execute an arbitrary 'set' method. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractExecutor
(Class<?> theClass, Method theMethod) Default and sole constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) static Integer
castInteger
(Object arg) Coerce an Object which must be a number to an Integer.(package private) static String
castString
(Object arg) Coerce an Object to a String.(package private) static Class<?>
Gets the class of an object or Object if null.boolean
boolean
equals
(AbstractExecutor arg) Indicates whether some other executor is equivalent to this one.final Method
Gets the method to be executed or used as a marker.final String
Gets the method name used.final Class<?>
Gets the object class targeted by this executor.Gets the property targeted by this executor.int
hashCode()
(package private) static Method
initMarker
(Class<?> clazz, String name, Class<?>... parms) A helper to initialize the marker methods (array.get, list.get, etc...).final boolean
isAlive()
Tell whether the executor is alive by looking at the value of the method.boolean
Specifies if this executor is cacheable and able to be reused for this class of object it was returned for.(package private) static Object[]
Creates an arguments array.final boolean
Checks whether a tryExecute failed or not.
-
Field Details
-
TRY_FAILED
A marker for invocation failures in tryInvoke. -
objectClass
The class this executor applies to. -
method
Method to be executed.
-
-
Constructor Details
-
AbstractExecutor
Default and sole constructor.- Parameters:
theClass
- the class this executor applies totheMethod
- the method held by this executor
-
-
Method Details
-
initMarker
A helper to initialize the marker methods (array.get, list.get, etc...).- Parameters:
clazz
- the class to introspectname
- the name of the methodparms
- the parameters- Returns:
- the method
-
castInteger
Coerce an Object which must be a number to an Integer.- Parameters:
arg
- the Object to coerce- Returns:
- an Integer if it can be converted, null otherwise
-
castString
Coerce an Object to a String.- Parameters:
arg
- the Object to coerce- Returns:
- a String if it can be converted, null otherwise
-
makeArgs
Creates an arguments array.- Parameters:
args
- the list of arguments- Returns:
- the arguments array
-
classOf
Gets the class of an object or Object if null.- Parameters:
instance
- the instance- Returns:
- the class
-
equals
-
hashCode
public int hashCode() -
equals
Indicates whether some other executor is equivalent to this one.- Parameters:
arg
- the other executor to check- Returns:
- true if both executors are equivalent, false otherwise
-
isAlive
public final boolean isAlive()Tell whether the executor is alive by looking at the value of the method.- Returns:
- boolean Whether the executor is alive.
-
isCacheable
public boolean isCacheable()Specifies if this executor is cacheable and able to be reused for this class of object it was returned for.- Returns:
- true if can be reused for this class, false if not
-
getMethod
Gets the method to be executed or used as a marker.- Returns:
- Method The method used by execute in derived classes.
-
getTargetClass
Gets the object class targeted by this executor.- Returns:
- the target object class
-
getTargetProperty
Gets the property targeted by this executor.- Returns:
- the target property
-
getMethodName
Gets the method name used.- Returns:
- method name
-
tryFailed
Checks whether a tryExecute failed or not.- Parameters:
exec
- the value returned by tryExecute- Returns:
- true if tryExecute failed, false otherwise
-