Class ClassMap.MethodCache
- java.lang.Object
-
- org.apache.velocity.util.introspection.ClassMap.MethodCache
-
- Enclosing class:
- ClassMap
private static final class ClassMap.MethodCache extends java.lang.Object
This is the cache to store and look up the method information.- Version:
- $Id: ClassMap.java 778038 2009-05-23 21:52:50Z nbubna $
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map
cache
Cache of Methods, or CACHE_MISS, keyed by method name and actual arguments used to find it.private static java.lang.Object
CACHE_MISS
private static java.util.Map
convertPrimitives
private Log
log
Class loggerprivate MethodMap
methodMap
Map of methods that are searchable according to method parameters to find a matchprivate static java.lang.String
NULL_ARG
-
Constructor Summary
Constructors Modifier Constructor Description private
MethodCache(Log log)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.Method
get(java.lang.String name, java.lang.Object[] params)
Find a Method using the method name and parameter objects.private java.lang.String
makeMethodKey(java.lang.reflect.Method method)
Make a methodKey for the given method using the concatenation of the name and the types of the method parameters.private java.lang.String
makeMethodKey(java.lang.String method, java.lang.Object[] params)
private void
put(java.lang.reflect.Method method)
-
-
-
Field Detail
-
CACHE_MISS
private static final java.lang.Object CACHE_MISS
-
NULL_ARG
private static final java.lang.String NULL_ARG
-
convertPrimitives
private static final java.util.Map convertPrimitives
-
log
private final Log log
Class logger
-
cache
private final java.util.Map cache
Cache of Methods, or CACHE_MISS, keyed by method name and actual arguments used to find it.
-
methodMap
private final MethodMap methodMap
Map of methods that are searchable according to method parameters to find a match
-
-
Constructor Detail
-
MethodCache
private MethodCache(Log log)
-
-
Method Detail
-
get
public java.lang.reflect.Method get(java.lang.String name, java.lang.Object[] params) throws MethodMap.AmbiguousException
Find a Method using the method name and parameter objects. Look in the methodMap for an entry. If found, it'll either be a CACHE_MISS, in which case we simply give up, or it'll be a Method, in which case, we return it. If nothing is found, then we must actually go and introspect the method from the MethodMap.- 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.
-
put
private void put(java.lang.reflect.Method method)
-
makeMethodKey
private java.lang.String makeMethodKey(java.lang.reflect.Method method)
Make a methodKey for the given method using the concatenation of the name and the types of the method parameters.- Parameters:
method
- to be stored as key- Returns:
- key for ClassMap
-
makeMethodKey
private java.lang.String makeMethodKey(java.lang.String method, java.lang.Object[] params)
-
-