Class ClassFieldMap


  • public class ClassFieldMap
    extends java.lang.Object
    A cache of introspection information for a specific class instance. Keys Field objects by the field names.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Class<?> clazz
      Class passed into the constructor used to as the basis for the Field map.
      private static boolean debugReflection
      Set true if you want to debug the reflection code
      private java.util.Map<java.lang.String,​java.lang.reflect.Field> fieldCache
      String --> Field map, the key is the field name
      private org.slf4j.Logger log
      Class logger
    • Constructor Summary

      Constructors 
      Constructor Description
      ClassFieldMap​(java.lang.Class<?> clazz, org.slf4j.Logger log)
      Standard constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.util.Map<java.lang.String,​java.lang.reflect.Field> createFieldCache()
      Populate the Map of direct hits.
      java.lang.reflect.Field findField​(java.lang.String name)
      Find a Field using the field name.
      java.lang.Class<?> getCachedClass()
      Returns the class object whose fields are cached by this map.
      private void populateFieldCacheWith​(java.util.Map<java.lang.String,​java.lang.reflect.Field> fieldCache, java.lang.Class<?> classToReflect)  
      private void populateFieldCacheWithInterface​(java.util.Map<java.lang.String,​java.lang.reflect.Field> fieldCache, java.lang.Class<?> iface)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 Field map.
      • fieldCache

        private final java.util.Map<java.lang.String,​java.lang.reflect.Field> fieldCache
        String --> Field map, the key is the field name
    • Constructor Detail

      • ClassFieldMap

        public ClassFieldMap​(java.lang.Class<?> clazz,
                             org.slf4j.Logger log)
        Standard constructor
        Parameters:
        clazz - The class for which this ClassMap gets constructed.
        log - logger
    • Method Detail

      • getCachedClass

        public java.lang.Class<?> getCachedClass()
        Returns the class object whose fields are cached by this map.
        Returns:
        The class object whose fields are cached by this map.
      • findField

        public java.lang.reflect.Field findField​(java.lang.String name)
        Find a Field using the field name.
        Parameters:
        name - The field name to look up.
        Returns:
        A Field object representing the field to invoke or null.
      • createFieldCache

        private java.util.Map<java.lang.String,​java.lang.reflect.Field> createFieldCache()
        Populate the Map of direct hits. These are taken from all the public fields that our class, its parents and their implemented interfaces provide.
      • populateFieldCacheWithInterface

        private void populateFieldCacheWithInterface​(java.util.Map<java.lang.String,​java.lang.reflect.Field> fieldCache,
                                                     java.lang.Class<?> iface)
      • populateFieldCacheWith

        private void populateFieldCacheWith​(java.util.Map<java.lang.String,​java.lang.reflect.Field> fieldCache,
                                            java.lang.Class<?> classToReflect)