Class Introspector
java.lang.Object
edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.internal.Introspector
- Direct Known Subclasses:
UberspectImpl
Default introspection services.
Finding methods as well as property getters & setters.
- Since:
- 1.0
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected final IntrospectorBase
base()
Gets the current introspector base.Class<?>
getClassByName
(String className) Gets a class by name through this introspector class loader.final Constructor<?>
getConstructor
(Object ctorHandle, Object[] args) Returns a general constructor.final Field
Gets the field named bykey
for the classc
.final String[]
getFieldNames
(Class<?> c) Gets the accessible field names known for a given class.final AbstractExecutor.Get
getGetExecutor
(Object obj, Object identifier) Return a property getter.final Method
Gets the method defined bykey
and for the Classc
.final Method
Gets the method defined byname
andparams
for the Classc
.final AbstractExecutor.Method
getMethodExecutor
(Object obj, String name, Object[] args) Returns a general method.final String[]
getMethodNames
(Class<?> c) Gets the accessible methods names known for a given class.final Method[]
getMethods
(Class<?> c, String methodName) Gets all the methods with a given name from this map.final AbstractExecutor.Set
getSetExecutor
(Object obj, Object identifier, Object arg) Return a property setter.void
setClassLoader
(ClassLoader loader) Sets the underlying class loader for class solving resolution.protected Integer
Coerce an Object to an Integer.protected String
Coerce an Object to a String.
-
Field Details
-
rlog
The logger to use for all warnings & errors.
-
-
Constructor Details
-
Introspector
Creates an introspector.- Parameters:
log
- the logger to use for warnings.
-
-
Method Details
-
toInteger
Coerce an Object to an Integer.- Parameters:
arg
- the Object to coerce- Returns:
- an Integer if it can be converted, null otherwise
-
toString
Coerce an Object to a String.- Parameters:
arg
- the Object to coerce- Returns:
- a String if it can be converted, null otherwise
-
base
Gets the current introspector base.If the reference has been collected, this method will recreate the underlying introspector.
- Returns:
- the introspector
-
setClassLoader
Sets the underlying class loader for class solving resolution.- Parameters:
loader
- the loader to use
-
getClassByName
Gets a class by name through this introspector class loader.- Parameters:
className
- the class name- Returns:
- the class instance or null if it could not be found
-
getField
Gets the field named bykey
for the classc
.- Parameters:
c
- Class in which the field search is taking placekey
- Name of the field being searched for- Returns:
- a
Field
or null if it does not exist or is not accessible
-
getFieldNames
Gets the accessible field names known for a given class.- Parameters:
c
- the class- Returns:
- the class field names
-
getMethod
Gets the method defined byname
andparams
for the Classc
.- Parameters:
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 parameters- Returns:
- a
Method
or null if no unambiguous method could be found through introspection.
-
getMethod
Gets the method defined bykey
and for the Classc
.- Parameters:
c
- Class in which the method search is taking placekey
- MethodKey of the method being searched for- Returns:
- a
Method
or null if no unambiguous method could be found through introspection.
-
getMethodNames
Gets the accessible methods names known for a given class.- Parameters:
c
- the class- Returns:
- the class method names
-
getMethods
Gets all the methods with a given name from this map.- Parameters:
c
- the classmethodName
- the seeked methods name- Returns:
- the array of methods
-
getConstructor
Returns a general constructor.- Parameters:
ctorHandle
- the objectargs
- contructor arguments- Returns:
- a
Constructor
or null if no unambiguous contructor could be found through introspection.
-
getMethodExecutor
Returns a general method.- Parameters:
obj
- the objectname
- the method nameargs
- method arguments- Returns:
- a
AbstractExecutor.Method
.
-
getGetExecutor
Return a property getter.- Parameters:
obj
- the object to base the property from.identifier
- property name- Returns:
- a
AbstractExecutor.Get
.
-
getSetExecutor
Return a property setter.- Parameters:
obj
- the object to base the property from.identifier
- property name (or identifier)arg
- value to set- Returns:
- a
AbstractExecutor.Set
.
-