public class Uberspect extends Object implements JexlUberspect
This is the class to derive to customize introspection.
JexlUberspect.JexlResolver, JexlUberspect.PropertyResolver, JexlUberspect.ResolverStrategy
Modifier and Type | Field and Description |
---|---|
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.
|
Uberspect(org.apache.commons.logging.Log runtimeLogger,
JexlUberspect.ResolverStrategy sty,
Permissions perms)
Creates a new Uberspect.
|
Modifier and Type | Method and Description |
---|---|
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.
|
ClassLoader |
getClassLoader()
Gets the current 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
public Uberspect(org.apache.commons.logging.Log runtimeLogger, JexlUberspect.ResolverStrategy sty)
runtimeLogger
- the logger used for all logging needssty
- the resolver strategypublic Uberspect(org.apache.commons.logging.Log runtimeLogger, JexlUberspect.ResolverStrategy sty, Permissions perms)
runtimeLogger
- the logger used for all logging needssty
- the resolver strategyperms
- the introspector permissionspublic void setClassLoader(ClassLoader nloader)
JexlUberspect
This increments the version.
setClassLoader
in interface JexlUberspect
nloader
- the class loaderpublic ClassLoader getClassLoader()
JexlUberspect
getClassLoader
in interface JexlUberspect
public int getVersion()
JexlUberspect
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)
JexlUberspect
getMethod
in interface JexlUberspect
obj
- the objectmethod
- the method nameargs
- method argumentsJexlMethod
public List<JexlUberspect.PropertyResolver> getResolvers(JexlOperator op, Object obj)
JexlUberspect
getResolvers
in interface JexlUberspect
op
- the operatorobj
- the objectpublic JexlPropertyGet getPropertyGet(Object obj, Object identifier)
JexlUberspect
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)
JexlUberspect
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)
JexlUberspect
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)
JexlUberspect
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)
JexlUberspect
getIterator
in interface JexlUberspect
obj
- to get the iterator frompublic JexlMethod getConstructor(Object ctorHandle, Object... args)
JexlUberspect
getConstructor
in interface JexlUberspect
ctorHandle
- a class or class nameargs
- constructor argumentsJexlMethod
public JexlArithmetic.Uberspect getArithmetic(JexlArithmetic arithmetic)
JexlUberspect
getArithmetic
in interface JexlUberspect
arithmetic
- the arithmetic instanceCopyright © 2001–2021 The Apache Software Foundation. All rights reserved.