Class ClassMap
- java.lang.Object
-
- org.apache.velocity.util.introspection.ClassMap
-
public class ClassMap extends java.lang.ObjectA cache of introspection information for a specific class instance. KeysMethodobjects by a concatenation of the method name and the names of classes that make up the parameters.- Version:
- $Id$
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classClassMap.MethodCacheThis is the cache to store and look up the method information.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<?>clazzClass passed into the constructor used to as the basis for the Method map.private static booleandebugReflectionSet true if you want to debug the reflection codeprivate org.slf4j.LoggerlogClass loggerprivate ClassMap.MethodCachemethodCache
-
Constructor Summary
Constructors Constructor Description ClassMap(java.lang.Class<?> clazz, org.slf4j.Logger log)Standard constructorClassMap(java.lang.Class<?> clazz, org.slf4j.Logger log, TypeConversionHandler conversionHandler)Standard constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ClassMap.MethodCachecreateMethodCache(TypeConversionHandler conversionHandler)Populate the Map of direct hits.java.lang.reflect.MethodfindMethod(java.lang.String name, java.lang.Object[] params)Find a Method using the method name and parameter objects.java.lang.Class<?>getCachedClass()Returns the class object whose methods are cached by this map.private voidpopulateMethodCacheWith(ClassMap.MethodCache methodCache, java.lang.Class<?> classToReflect)private voidpopulateMethodCacheWithInterface(ClassMap.MethodCache methodCache, java.lang.Class<?> iface)
-
-
-
Field Detail
-
debugReflection
private static final boolean debugReflection
Set true if you want to debug the reflection code- See Also:
- Constant Field Values
-
log
private final org.slf4j.Logger log
Class logger
-
clazz
private final java.lang.Class<?> clazz
Class passed into the constructor used to as the basis for the Method map.
-
methodCache
private final ClassMap.MethodCache methodCache
-
-
Constructor Detail
-
ClassMap
public ClassMap(java.lang.Class<?> clazz, org.slf4j.Logger log)Standard constructor- Parameters:
clazz- The class for which this ClassMap gets constructed.log- logger
-
ClassMap
public ClassMap(java.lang.Class<?> clazz, org.slf4j.Logger log, TypeConversionHandler conversionHandler)Standard constructor- Parameters:
clazz- The class for which this ClassMap gets constructed.log- loggerconversionHandler- conversion handler- Since:
- 2.0
-
-
Method Detail
-
getCachedClass
public java.lang.Class<?> getCachedClass()
Returns the class object whose methods are cached by this map.- Returns:
- The class object whose methods are cached by this map.
-
findMethod
public java.lang.reflect.Method findMethod(java.lang.String name, java.lang.Object[] params) throws MethodMap.AmbiguousExceptionFind a Method using the method name and parameter objects.- Parameters:
name- The method name to look up.params- An array of parameters for the method.- Returns:
- A Method object representing the method to invoke or null.
- Throws:
MethodMap.AmbiguousException- When more than one method is a match for the parameters.
-
createMethodCache
private ClassMap.MethodCache createMethodCache(TypeConversionHandler conversionHandler)
Populate the Map of direct hits. These are taken from all the public methods that our class, its parents and their implemented interfaces provide.
-
populateMethodCacheWithInterface
private void populateMethodCacheWithInterface(ClassMap.MethodCache methodCache, java.lang.Class<?> iface)
-
populateMethodCacheWith
private void populateMethodCacheWith(ClassMap.MethodCache methodCache, java.lang.Class<?> classToReflect)
-
-