Class ClassMap.MethodCache

java.lang.Object
org.apache.velocity.util.introspection.ClassMap.MethodCache
Enclosing class:
ClassMap

private static final class ClassMap.MethodCache extends 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 Details

    • CACHE_MISS

      private static final Object CACHE_MISS
    • NULL_ARG

      private static final String NULL_ARG
    • convertPrimitives

      private static final Map convertPrimitives
    • log

      private final Log log
      Class logger
    • cache

      private final 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 Details

    • MethodCache

      private MethodCache(Log log)
  • Method Details

    • get

      public Method get(String name, 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(Method method)
    • makeMethodKey

      private String makeMethodKey(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 String makeMethodKey(String method, Object[] params)