psdi.webclient.system.controller

Class LabelCache

  • java.lang.Object
    • java.util.AbstractMap
      • java.util.HashMap
        • psdi.webclient.system.controller.LabelCache
  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map


    @TraceDisabled
    public class LabelCache
    extends java.util.HashMap
    This class is used to cache all of the id/property values for a single app instance. The getCacheKey method should always be used to get a single unique key for this object when it is added to a hashmap
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry, java.util.AbstractMap.SimpleImmutableEntry
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry
    • Constructor Summary

      Constructors 
      Constructor and Description
      LabelCache(int initialCapacity, float loadFactor, java.lang.String anapp)
      Constructor taking both hash map sizing parameters (initialCapacity, loadFactor).
      LabelCache(int initialCapacity, java.lang.String anapp)
      Constructor taking HashMap initial capacity
      LabelCache(java.lang.String anapp)
      Constructor using default HashMap values
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String get(java.lang.String key)
      Fetches the string value for control id/property.
      java.lang.String getCacheApp()
      Returns the application this cache is for
      java.util.Date getCacheCreateDate()
      Returns the data/time this cache was created
      java.lang.String getString(java.lang.String id, java.lang.String property)
      Fetches the string value for control id/property.
      boolean isModified()
      Returns true of cache was modified
      static java.lang.String makeUniqueKey(java.lang.String id, java.lang.String property)
      Makes a concatenated key for control id/property pairs.
      java.lang.Object put(java.lang.String id, java.lang.String property, java.lang.Object value)
      Put method added to take the two keys and the value.
      java.lang.Object remove(java.lang.String id, java.lang.String property) 
      void setModified(boolean modified)
      Sets the cache to be modified or not
      • Methods inherited from class java.util.HashMap

        clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        equals, hashCode
    • Constructor Detail

      • LabelCache

        public LabelCache(int initialCapacity,
                          float loadFactor,
                          java.lang.String anapp)
        Constructor taking both hash map sizing parameters (initialCapacity, loadFactor).
        Parameters:
        initialCapacity - The initial capacity
        loadFactor - The load factor
        anapp - Application the cache is for
        See Also:
        HashMap
      • LabelCache

        public LabelCache(int initialCapacity,
                          java.lang.String anapp)
        Constructor taking HashMap initial capacity
        Parameters:
        initialCapacity - The initial capacity
        alocale - Locale the cache is for
        anapp - Application the cache is for
        atype - Type of labels in the cache
        See Also:
        HashMap
      • LabelCache

        public LabelCache(java.lang.String anapp)
        Constructor using default HashMap values
        Parameters:
        alocale - Locale the cache is for
        anapp - Application the cache is for
        atype - Type of labels in the cache
        See Also:
        HashMap
    • Method Detail

      • makeUniqueKey

        public static java.lang.String makeUniqueKey(java.lang.String id,
                                                     java.lang.String property)
        Makes a concatenated key for control id/property pairs. Necessary since hashmaps only take a single key and we need to have the 'primary key' be both the control id and the property.
        Parameters:
        id - control id for the property
        property - name of the property
        Returns:
        a unique key
      • getCacheApp

        public java.lang.String getCacheApp()
        Returns the application this cache is for
        Returns:
        The application
      • getCacheCreateDate

        public java.util.Date getCacheCreateDate()
        Returns the data/time this cache was created
        Returns:
        The creation date/time
      • put

        public java.lang.Object put(java.lang.String id,
                                    java.lang.String property,
                                    java.lang.Object value)
        Put method added to take the two keys and the value. A single unique key is generated before putting the value into this hashmap. The base 'HashMap.put' method should not be used on the class.
        Parameters:
        id - Control id
        property - Control Property
        value - The value to be added to the hashmap
        Returns:
        the return value from HashMap.put
      • remove

        public java.lang.Object remove(java.lang.String id,
                                       java.lang.String property)
      • get

        public java.lang.String get(java.lang.String key)
        Fetches the string value for control id/property.
        Parameters:
        key - Control key
        Returns:
        Value for the property, or null if not found or not a String
      • getString

        public java.lang.String getString(java.lang.String id,
                                          java.lang.String property)
        Fetches the string value for control id/property.
        Parameters:
        id - Control id
        property - Control Property
        Returns:
        Value for the property, or null if not found or not a String
      • isModified

        public boolean isModified()
        Returns true of cache was modified
      • setModified

        public void setModified(boolean modified)
        Sets the cache to be modified or not