Class IntrospectorCacheImpl

  • All Implemented Interfaces:
    IntrospectorCache

    public final class IntrospectorCacheImpl
    extends java.lang.Object
    implements IntrospectorCache
    This is the internal introspector cache implementation.
    Since:
    1.5
    Version:
    $Id: IntrospectorCacheImpl.java 898032 2010-01-11 19:51:03Z nbubna $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CACHEDUMP_MSG
      define a public string so that it can be looked for if interested
      private java.util.Map classMapCache
      Holds the method maps for the classes we know about.
      private java.util.Set classNameCache
      Keep the names of the classes in another map.
      private Log log
      Class logger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears the internal cache.
      ClassMap get​(java.lang.Class c)
      Lookup a given Class object in the cache.
      ClassMap put​(java.lang.Class c)
      Creates a class map for specific class and registers it in the cache.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CACHEDUMP_MSG

        public static final java.lang.String CACHEDUMP_MSG
        define a public string so that it can be looked for if interested
        See Also:
        Constant Field Values
      • log

        private final Log log
        Class logger
      • classMapCache

        private final java.util.Map classMapCache
        Holds the method maps for the classes we know about. Map: Class --> ClassMap object.
      • classNameCache

        private final java.util.Set classNameCache
        Keep the names of the classes in another map. This is needed for a multi-classloader environment where it is possible to have Class 'Foo' loaded by a classloader and then get asked to introspect on 'Foo' from another class loader. While these two Class objects have the same name, a classMethodMaps.get(Foo.class) will return null. For that case, we keep a set of class names to recognize this case.
    • Constructor Detail

      • IntrospectorCacheImpl

        public IntrospectorCacheImpl​(Log log)
        C'tor
    • Method Detail

      • get

        public ClassMap get​(java.lang.Class c)
        Lookup a given Class object in the cache. If it does not exist, check whether this is due to a class change and purge the caches eventually.
        Specified by:
        get in interface IntrospectorCache
        Parameters:
        c - The class to look up.
        Returns:
        A ClassMap object or null if it does not exist in the cache.
      • put

        public ClassMap put​(java.lang.Class c)
        Creates a class map for specific class and registers it in the cache. Also adds the qualified name to the name->class map for later Classloader change detection.
        Specified by:
        put in interface IntrospectorCache
        Parameters:
        c - The class for which the class map gets generated.
        Returns:
        A ClassMap object.