Class DuckGetExecutor
java.lang.Object
org.apache.commons.jexl3.internal.introspection.AbstractExecutor
org.apache.commons.jexl3.internal.introspection.AbstractExecutor.Get
org.apache.commons.jexl3.internal.introspection.DuckGetExecutor
- All Implemented Interfaces:
JexlPropertyGet
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.commons.jexl3.internal.introspection.AbstractExecutor
AbstractExecutor.Get, AbstractExecutor.Method, AbstractExecutor.Set -
Field Summary
FieldsFields inherited from class org.apache.commons.jexl3.internal.introspection.AbstractExecutor
method, objectClass, TRY_FAILED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateDuckGetExecutor(Class<?> clazz, Method method, Object identifier) Creates an instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic DuckGetExecutordiscover(Introspector is, Class<?> clazz, Object identifier) Attempts to discover a DuckGetExecutor.Gets the property targeted by this executor.Method used to get the property value of an object.Attempts to reuse this JexlPropertyGet, checking that it is compatible with the actual set of arguments.Methods inherited from class org.apache.commons.jexl3.internal.introspection.AbstractExecutor
castInteger, castString, classOf, equals, equals, getMethod, getMethodName, getTargetClass, hashCode, initMarker, isAlive, isCacheable, makeArgs, tryFailedMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.jexl3.introspection.JexlPropertyGet
isCacheable, tryFailed
-
Field Details
-
property
The property, may be null.
-
-
Constructor Details
-
DuckGetExecutor
Creates an instance.- Parameters:
clazz- he class the get method applies tomethod- the method held by this executoridentifier- the property to get
-
-
Method Details
-
discover
Attempts to discover a DuckGetExecutor.- Parameters:
is- the introspectorclazz- the class to find the get method fromidentifier- the key to use as an argument to the get method- Returns:
- the executor if found, null otherwise
-
getTargetProperty
Description copied from class:AbstractExecutorGets the property targeted by this executor.- Overrides:
getTargetPropertyin classAbstractExecutor- Returns:
- the target property
-
invoke
Description copied from interface:JexlPropertyGetMethod used to get the property value of an object.- Parameters:
obj- the object to get the property value from.- Returns:
- the property value.
- Throws:
IllegalAccessExceptionInvocationTargetException
-
tryInvoke
Description copied from interface:JexlPropertyGetAttempts to reuse this JexlPropertyGet, checking that it is compatible with the actual set of arguments.- Parameters:
obj- the object to invoke the property get uponkey- the property key to get- Returns:
- the result of the method invocation that should be checked by tryFailed to determine if it succeeded or failed.
-