public class Uberspect extends Object implements JexlUberspect
This is the class to derive to customize introspection.
Modifier and Type | Class and Description |
---|---|
protected class |
Uberspect.ArithmeticUberspect
The concrete uberspect Arithmetic class.
|
JexlUberspect.JexlResolver, JexlUberspect.PropertyResolver, JexlUberspect.ResolverStrategy
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
rlog
The logger to use for all warnings and errors.
|
static Object |
TRY_FAILED
Publicly exposed special failure object returned by tryInvoke.
|
JEXL_STRATEGY, MAP, MAP_STRATEGY, POJO
Constructor and Description |
---|
Uberspect(org.apache.commons.logging.Log runtimeLogger,
JexlUberspect.ResolverStrategy sty)
Creates a new Uberspect.
|
Modifier and Type | Method and Description |
---|---|
protected Introspector |
base()
Gets the current introspector base.
|
JexlArithmetic.Uberspect |
getArithmetic(JexlArithmetic arithmetic)
Gets an arithmetic operator resolver for a given arithmetic instance.
|
Class<?> |
getClassByName(String className)
Gets a class by name through this introspector class loader.
|
JexlMethod |
getConstructor(Object ctorHandle,
Object... args)
Returns a class constructor.
|
Field |
getField(Class<?> c,
String key)
Gets the field named by
key for the class
c . |
String[] |
getFieldNames(Class<?> c)
Gets the accessible field names known for a given class.
|
Iterator<?> |
getIterator(Object obj)
Gets an iterator from an object.
|
Method |
getMethod(Class<?> c,
MethodKey key)
Gets the method defined by
key and for the Class
c . |
Method |
getMethod(Class<?> c,
String name,
Object[] params)
Gets the method defined by
name and
params for the Class
c . |
JexlMethod |
getMethod(Object obj,
String method,
Object... args)
Returns a JexlMethod.
|
String[] |
getMethodNames(Class<?> c)
Gets the accessible methods names known for a given class.
|
Method[] |
getMethods(Class<?> c,
String methodName)
Gets all the methods with a given name from this map.
|
JexlPropertyGet |
getPropertyGet(List<JexlUberspect.PropertyResolver> resolvers,
Object obj,
Object identifier)
Property getter.
|
JexlPropertyGet |
getPropertyGet(Object obj,
Object identifier)
Property getter.
|
JexlPropertySet |
getPropertySet(List<JexlUberspect.PropertyResolver> resolvers,
Object obj,
Object identifier,
Object arg)
Property setter.
|
JexlPropertySet |
getPropertySet(Object obj,
Object identifier,
Object arg)
Property setter.
|
List<JexlUberspect.PropertyResolver> |
getResolvers(JexlOperator op,
Object obj)
Applies this uberspect property resolver strategy.
|
int |
getVersion()
Gets this uberspect version.
|
void |
setClassLoader(ClassLoader nloader)
Sets the class loader to use.
|
public static final Object TRY_FAILED
protected final org.apache.commons.logging.Log rlog
public Uberspect(org.apache.commons.logging.Log runtimeLogger, JexlUberspect.ResolverStrategy sty)
runtimeLogger
- the logger used for all logging needssty
- the resolver strategyprotected final Introspector base()
If the reference has been collected, this method will recreate the underlying introspector.
public void setClassLoader(ClassLoader nloader)
This increments the version.
setClassLoader
in interface JexlUberspect
nloader
- the class loaderpublic int getVersion()
getVersion
in interface JexlUberspect
public final Class<?> getClassByName(String className)
className
- the class namepublic final Field getField(Class<?> c, String key)
key
for the class
c
.c
- Class in which the field search is taking placekey
- Name of the field being searched forField
or null if it does not exist or is not accessiblepublic final String[] getFieldNames(Class<?> c)
c
- the classpublic final Method getMethod(Class<?> c, String name, Object[] params)
name
and
params
for the Class
c
.c
- Class in which the method search is taking placename
- Name of the method being searched forparams
- An array of Objects (not Classes) that describe the
the parametersMethod
or null if no unambiguous method could be found through introspection.public final Method getMethod(Class<?> c, MethodKey key)
key
and for the Class
c
.c
- Class in which the method search is taking placekey
- MethodKey of the method being searched forMethod
or null if no unambiguous method could be found through introspection.public final String[] getMethodNames(Class<?> c)
c
- the classpublic final Method[] getMethods(Class<?> c, String methodName)
c
- the classmethodName
- the seeked methods namepublic JexlMethod getMethod(Object obj, String method, Object... args)
getMethod
in interface JexlUberspect
obj
- the objectmethod
- the method nameargs
- method argumentsJexlMethod
public List<JexlUberspect.PropertyResolver> getResolvers(JexlOperator op, Object obj)
getResolvers
in interface JexlUberspect
op
- the operatorobj
- the objectpublic JexlPropertyGet getPropertyGet(Object obj, Object identifier)
returns a JelPropertySet apropos to an expression like bar.woogie
.
getPropertyGet
in interface JexlUberspect
obj
- the object to get the property fromidentifier
- property nameJexlPropertyGet
or nullpublic JexlPropertyGet getPropertyGet(List<JexlUberspect.PropertyResolver> resolvers, Object obj, Object identifier)
Seeks a JexlPropertyGet apropos to an expression like bar.woogie
.
JexlUberspect.ResolverStrategy.apply(JexlOperator, java.lang.Object)
getPropertyGet
in interface JexlUberspect
resolvers
- the list of property resolvers to tryobj
- the object to get the property fromidentifier
- property nameJexlPropertyGet
or nullpublic JexlPropertySet getPropertySet(Object obj, Object identifier, Object arg)
Seeks a JelPropertySet apropos to an expression like foo.bar = "geir"
.
getPropertySet
in interface JexlUberspect
obj
- the object to get the property from.identifier
- property namearg
- value to setJexlPropertySet
or nullpublic JexlPropertySet getPropertySet(List<JexlUberspect.PropertyResolver> resolvers, Object obj, Object identifier, Object arg)
Seeks a JelPropertySet apropos to an expression like foo.bar = "geir"
.
JexlUberspect.ResolverStrategy.apply(JexlOperator, java.lang.Object)
getPropertySet
in interface JexlUberspect
resolvers
- the list of property resolvers to try,obj
- the object to get the property fromidentifier
- property namearg
- value to setJexlPropertySet
or nullpublic Iterator<?> getIterator(Object obj)
getIterator
in interface JexlUberspect
obj
- to get the iterator frompublic JexlMethod getConstructor(Object ctorHandle, Object... args)
getConstructor
in interface JexlUberspect
ctorHandle
- a class or class nameargs
- constructor argumentsJexlMethod
public JexlArithmetic.Uberspect getArithmetic(JexlArithmetic arithmetic)
getArithmetic
in interface JexlUberspect
arithmetic
- the arithmetic instanceCopyright © 2001–2015 The Apache Software Foundation. All rights reserved.