Class IntrospectorBase
java.lang.Object
org.apache.commons.jexl2.internal.introspection.IntrospectorBase
This basic function of this class is to return a Method object for a
particular class given the name of a method and the parameters to the method
in the form of an Object[]
The first time the Introspector sees a class it creates a class method map for the class in question. Basically the class method map is a Hastable where Method objects are keyed by a concatenation of the method name and the names of classes that make up the parameters. For example, a method with the following signature: public void method(String a, StringBuffer b) would be mapped by the key: "method" + "java.lang.String" + "java.lang.StringBuffer" This mapping is performed for all the methods in a class and stored.
- Since:
- 1.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIntrospectorBase(org.apache.commons.logging.Log log) Create the introspector. -
Method Summary
Modifier and TypeMethodDescriptionClass<?> getClassByName(String className) Gets a class by name through this introspector class loader.Constructor<?> getConstructor(Class<?> c, MethodKey key) Gets the constructor defined by theMethodKey.Constructor<?> getConstructor(MethodKey key) Gets the constructor defined by theMethodKey.Gets the field named bykeyfor the classc.String[]getFieldNames(Class<?> c) Gets the array of accessible field names known for a given class.Gets the method defined by theMethodKeyfor the classc.String[]getMethodNames(Class<?> c) Gets the array of accessible methods names known for a given class.Method[]getMethods(Class<?> c, String methodName) Gets the array of accessible method known for a given class.voidsetLoader(ClassLoader cloader) Sets the class loader used to solve constructors.
-
Field Details
-
rlog
the logger.
-
-
Constructor Details
-
IntrospectorBase
Create the introspector.- Parameters:
log- the logger to use
-
-
Method Details
-
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
-
getMethod
Gets the method defined by theMethodKeyfor the classc.- Parameters:
c- Class in which the method search is taking placekey- Key of the method being searched for- Returns:
- The desired method object
- Throws:
MethodKey.AmbiguousException- if no unambiguous method could be found through introspection
-
getField
-
getFieldNames
Gets the array of accessible field names known for a given class.- Parameters:
c- the class- Returns:
- the class field names
-
getMethodNames
Gets the array of accessible methods names known for a given class.- Parameters:
c- the class- Returns:
- the class method names
-
getMethods
Gets the array of accessible method known for a given class.- Parameters:
c- the classmethodName- the method name- Returns:
- the array of methods (null or not empty)
-
setLoader
Sets the class loader used to solve constructors.Also cleans the constructors and methods caches.
- Parameters:
cloader- the class loader; if null, use this instance class loader
-
getConstructor
Gets the constructor defined by theMethodKey.- Parameters:
key- Key of the constructor being searched for- Returns:
- The desired constructor object or null if no unambiguous constructor could be found through introspection.
-
getConstructor
Gets the constructor defined by theMethodKey.- Parameters:
c- the class we want to instantiatekey- Key of the constructor being searched for- Returns:
- The desired constructor object or null if no unambiguous constructor could be found through introspection.
-