Class Introspector
java.lang.Object
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
FieldsModifier and TypeFieldDescriptionprotected final org.apache.commons.logging.LogThe logger to use for all warnings & errors. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIntrospector(org.apache.commons.logging.Log log) Creates an introspector. -
Method Summary
Modifier and TypeMethodDescriptionprotected final IntrospectorBasebase()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 FieldGets the field named bykeyfor the classc.final String[]getFieldNames(Class<?> c) Gets the accessible field names known for a given class.final AbstractExecutor.GetgetGetExecutor(Object obj, Object identifier) Return a property getter.final MethodGets the method defined bynameandparamsfor the Classc.final MethodGets the method defined bykeyand for the Classc.final AbstractExecutor.MethodgetMethodExecutor(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.SetgetSetExecutor(Object obj, Object identifier, Object arg) Return a property setter.voidsetClassLoader(ClassLoader loader) Sets the underlying class loader for class solving resolution.protected IntegerCoerce an Object to an Integer.protected StringCoerce 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
-
toString
-
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
-
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 bynameandparamsfor 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
Methodor null if no unambiguous method could be found through introspection.
-
getMethod
Gets the method defined bykeyand for the Classc.- Parameters:
c- Class in which the method search is taking placekey- MethodKey of the method being searched for- Returns:
- a
Methodor 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
Constructoror 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.
-