Class UberspectImpl
- java.lang.Object
-
- org.apache.commons.jexl2.internal.Introspector
-
- org.apache.commons.jexl2.introspection.UberspectImpl
-
- All Implemented Interfaces:
Uberspect
- Direct Known Subclasses:
SandboxUberspectImpl
public class UberspectImpl extends Introspector implements Uberspect
Implementation of Uberspect to provide the default introspective functionality of JEXL.This is the class to derive to customize introspection.
- Since:
- 1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUberspectImpl.FieldPropertyGetDeprecated.Do not use externally - will be made private in a later versionstatic classUberspectImpl.FieldPropertySetDeprecated.Do not use externally - will be made private in a later versionstatic classUberspectImpl.IndexedContainerA generic indexed property container, exposes get(key) and set(key, value) and solves method call dynamically based on arguments.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.ObjectTRY_FAILEDPublicly exposed special failure object returned by tryInvoke.-
Fields inherited from class org.apache.commons.jexl2.internal.Introspector
rlog
-
-
Constructor Summary
Constructors Constructor Description UberspectImpl(org.apache.commons.logging.Log runtimeLogger)Creates a new UberspectImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.reflect.Constructor<?>getConstructor(java.lang.Object ctorHandle, java.lang.Object[] args, JexlInfo info)Deprecated.JexlMethodgetConstructorMethod(java.lang.Object ctorHandle, java.lang.Object[] args, JexlInfo info)Returns a class constructor wrapped in a JexlMethod.java.lang.reflect.FieldgetField(java.lang.Object obj, java.lang.String name, JexlInfo info)Returns a class field.protected JexlPropertyGetgetIndexedGet(java.lang.Object object, java.lang.String name)Attempts to find an indexed-property getter in an object.java.util.Iterator<?>getIterator(java.lang.Object obj, JexlInfo info)Gets an iterator from an object.JexlMethodgetMethod(java.lang.Object obj, java.lang.String method, java.lang.Object[] args, JexlInfo info)Returns a JexlMethod.JexlPropertyGetgetPropertyGet(java.lang.Object obj, java.lang.Object identifier, JexlInfo info)Property getter.JexlPropertySetgetPropertySet(java.lang.Object obj, java.lang.Object identifier, java.lang.Object arg, JexlInfo info)Property setter.voidsetLoader(java.lang.ClassLoader cloader)Resets this Uberspect class loader.-
Methods inherited from class org.apache.commons.jexl2.internal.Introspector
base, getClassByName, getConstructor, getField, getFieldNames, getGetExecutor, getMethod, getMethod, getMethodExecutor, getMethodNames, getMethods, getSetExecutor, setClassLoader, toInteger, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.jexl2.introspection.Uberspect
setClassLoader
-
-
-
-
Field Detail
-
TRY_FAILED
public static final java.lang.Object TRY_FAILED
Publicly exposed special failure object returned by tryInvoke.
-
-
Constructor Detail
-
UberspectImpl
public UberspectImpl(org.apache.commons.logging.Log runtimeLogger)
Creates a new UberspectImpl.- Parameters:
runtimeLogger- the logger used for all logging needs
-
-
Method Detail
-
setLoader
public void setLoader(java.lang.ClassLoader cloader)
Resets this Uberspect class loader.- Parameters:
cloader- the class loader to use- Since:
- 2.1
-
getIterator
public java.util.Iterator<?> getIterator(java.lang.Object obj, JexlInfo info)
Gets an iterator from an object.- Specified by:
getIteratorin interfaceUberspect- Parameters:
obj- to get the iterator forinfo- contextual information- Returns:
- an iterator over obj
-
getMethod
public JexlMethod getMethod(java.lang.Object obj, java.lang.String method, java.lang.Object[] args, JexlInfo info)
Returns a JexlMethod.- Specified by:
getMethodin interfaceUberspect- Parameters:
obj- the objectmethod- the method nameargs- method argumentsinfo- contextual information- Returns:
- a
JexlMethod
-
getConstructor
@Deprecated public java.lang.reflect.Constructor<?> getConstructor(java.lang.Object ctorHandle, java.lang.Object[] args, JexlInfo info)
Deprecated.Returns a class constructor.- Specified by:
getConstructorin interfaceUberspect- Parameters:
ctorHandle- a class or class nameargs- constructor argumentsinfo- contextual information- Returns:
- a
Constructor
-
getConstructorMethod
public JexlMethod getConstructorMethod(java.lang.Object ctorHandle, java.lang.Object[] args, JexlInfo info)
Returns a class constructor wrapped in a JexlMethod.- Specified by:
getConstructorMethodin interfaceUberspect- Parameters:
ctorHandle- a class or class nameargs- constructor argumentsinfo- contextual information- Returns:
- a
Constructor - Since:
- 2.1
-
getPropertyGet
public JexlPropertyGet getPropertyGet(java.lang.Object obj, java.lang.Object identifier, JexlInfo info)
Property getter.Returns JexlPropertyGet appropos for ${bar.woogie}.
- Specified by:
getPropertyGetin interfaceUberspect- Parameters:
obj- the object to get the property fromidentifier- property nameinfo- contextual information- Returns:
- a
JexlPropertyGet
-
getPropertySet
public JexlPropertySet getPropertySet(java.lang.Object obj, java.lang.Object identifier, java.lang.Object arg, JexlInfo info)
Property setter.returns JelPropertySet appropos for ${foo.bar = "geir"}
.- Specified by:
getPropertySetin interfaceUberspect- Parameters:
obj- the object to get the property from.identifier- property namearg- value to setinfo- contextual information- Returns:
- a
JexlPropertySet.
-
getField
public java.lang.reflect.Field getField(java.lang.Object obj, java.lang.String name, JexlInfo info)
Returns a class field. Only for use by sub-classes, will be made protected in a later version- Parameters:
obj- the objectname- the field nameinfo- debug info- Returns:
- a
Field.
-
getIndexedGet
protected JexlPropertyGet getIndexedGet(java.lang.Object object, java.lang.String name)
Attempts to find an indexed-property getter in an object. The code attempts to find the list of methods getXXX() and setXXX(). Note that this is not equivalent to the strict bean definition of indexed properties; the type of the key is not necessarily an int and the set/get arrays are not resolved.- Parameters:
object- the objectname- the container name- Returns:
- a JexlPropertyGet is successfull, null otherwise
- Since:
- 2.1
-
-