Class UserCustomAttributesMap<T>

  • All Implemented Interfaces:
    java.util.Map<java.lang.String,​java.util.List<java.lang.Object>>

    public class UserCustomAttributesMap<T>
    extends java.util.AbstractMap<java.lang.String,​T>
    Custom map implementation for storing user attribute values. Designed to be used by MonitorUser and UserConfig.
    Since:
    11.0.0
    Version:
    $Revision: 24477 $ $Date: 2021-04-28 11:30:36 -0300 (Wed, 28 Apr 2021) $
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  UserCustomAttributesMap.EntityFactory<T>
      The functional interface used to create user attribute entity to be persisted.
      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      UserCustomAttributesMap​(java.lang.String serviceInstaceId, java.util.Map<java.lang.String,​T> storage, UserCustomAttributesMap.EntityFactory<T> attributeEntityFactory, java.util.function.Function<T,​java.lang.String> attributeEntityReader, java.lang.Runnable modificationCallback)
      Creates a new map that reflects view and changes on the given map transforming the values with the given functions.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      boolean containsKey​(java.lang.Object key)  
      java.util.Set<java.util.Map.Entry<java.lang.String,​T>> entrySet()  
      T get​(java.lang.Object key)  
      T put​(java.lang.String key, T value)  
      T remove​(java.lang.Object key)  
      protected java.util.List<java.lang.Object> storedToTransformed​(java.lang.String attributeId, T attributeEntity)
      Converts an attribute entity instance to the value according to its data type.
      protected T transformedToStored​(java.lang.String attributeId, java.util.List<java.lang.Object> value)
      Converts a data value to the attribute entity instance.
      • Methods inherited from class java.util.AbstractMap

        clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values
      • Methods inherited from class java.lang.Object

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

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Constructor Detail

      • UserCustomAttributesMap

        public UserCustomAttributesMap​(java.lang.String serviceInstaceId,
                                       java.util.Map<java.lang.String,​T> storage,
                                       UserCustomAttributesMap.EntityFactory<T> attributeEntityFactory,
                                       java.util.function.Function<T,​java.lang.String> attributeEntityReader,
                                       java.lang.Runnable modificationCallback)
        Creates a new map that reflects view and changes on the given map transforming the values with the given functions.
        Parameters:
        serviceInstaceId - the service instance identifier group attributes.
        storage - the underlying map.
        attributeEntityFactory - function that returns a new attribute entity instance for a attribute identifier and string value pair.
        attributeEntityReader - function that returns the string value from a attribute entity instance.
        modificationCallback - function called when this map is modified (element added, updated or removed).
        Since:
        14.0.0
    • Method Detail

      • transformedToStored

        protected T transformedToStored​(java.lang.String attributeId,
                                        java.util.List<java.lang.Object> value)
        Converts a data value to the attribute entity instance.
        Parameters:
        attributeId - the attribute identifier.
        value - the value with type according to the attribute data type.
        Returns:
        the attribute entity instance.
        Since:
        12.0.0
      • storedToTransformed

        protected java.util.List<java.lang.Object> storedToTransformed​(java.lang.String attributeId,
                                                                       T attributeEntity)
        Converts an attribute entity instance to the value according to its data type.
        Parameters:
        attributeId - the attribute identifier.
        attributeEntity - the attribute entity instance.
        Returns:
        the value.
        Since:
        12.0.0
      • entrySet

        public java.util.Set<java.util.Map.Entry<java.lang.String,​T>> entrySet()
        Specified by:
        entrySet in interface java.util.Map<S,​T>
        Specified by:
        entrySet in class java.util.AbstractMap<java.lang.String,​T>
      • put

        public T put​(java.lang.String key,
                     T value)
        Specified by:
        put in interface java.util.Map<S,​T>
        Overrides:
        put in class java.util.AbstractMap<java.lang.String,​T>
      • get

        public T get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<S,​T>
        Overrides:
        get in class java.util.AbstractMap<java.lang.String,​T>
      • remove

        public T remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<S,​T>
        Overrides:
        remove in class java.util.AbstractMap<java.lang.String,​T>
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface java.util.Map<S,​T>
        Overrides:
        containsKey in class java.util.AbstractMap<java.lang.String,​T>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<S,​T>
        Overrides:
        clear in class java.util.AbstractMap<java.lang.String,​T>