Package lumis.portal.user
Class UserCustomAttributesMap<T>
- java.lang.Object
-
- java.util.AbstractMap<String,T>
-
- lumis.portal.user.UserCustomAttributesMap<T>
-
public class UserCustomAttributesMap<T> extends AbstractMap<String,T>
Custom map implementation for storing user attribute values. Designed to be used byMonitorUser
andUserConfig
.- 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
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description UserCustomAttributesMap(String serviceInstaceId, Map<String,T> storage, UserCustomAttributesMap.EntityFactory<T> attributeEntityFactory, java.util.function.Function<T,String> attributeEntityReader, 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(Object key)
Set<Map.Entry<String,T>>
entrySet()
T
get(Object key)
T
put(String key, T value)
T
remove(Object key)
protected List<Object>
storedToTransformed(String attributeId, T attributeEntity)
Converts an attribute entity instance to the value according to its data type.protected T
transformedToStored(String attributeId, List<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(String serviceInstaceId, Map<String,T> storage, UserCustomAttributesMap.EntityFactory<T> attributeEntityFactory, java.util.function.Function<T,String> attributeEntityReader, 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(String attributeId, List<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 List<Object> storedToTransformed(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 Set<Map.Entry<String,T>> entrySet()
- Specified by:
entrySet
in interfaceMap<S,T>
- Specified by:
entrySet
in classAbstractMap<String,T>
-
put
public T put(String key, T value)
- Specified by:
put
in interfaceMap<S,T>
- Overrides:
put
in classAbstractMap<String,T>
-
get
public T get(Object key)
- Specified by:
get
in interfaceMap<S,T>
- Overrides:
get
in classAbstractMap<String,T>
-
remove
public T remove(Object key)
- Specified by:
remove
in interfaceMap<S,T>
- Overrides:
remove
in classAbstractMap<String,T>
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<S,T>
- Overrides:
containsKey
in classAbstractMap<String,T>
-
clear
public void clear()
- Specified by:
clear
in interfaceMap<S,T>
- Overrides:
clear
in classAbstractMap<String,T>
-
-