Package lumis.portal.user
Class UserCustomAttributesMap<T>
- java.lang.Object
-
- java.util.AbstractMap<java.lang.String,T>
-
- lumis.portal.user.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 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.
-
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
-
-
-
-
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 interfacejava.util.Map<S,T>
- Specified by:
entrySet
in classjava.util.AbstractMap<java.lang.String,T>
-
put
public T put(java.lang.String key, T value)
- Specified by:
put
in interfacejava.util.Map<S,T>
- Overrides:
put
in classjava.util.AbstractMap<java.lang.String,T>
-
get
public T get(java.lang.Object key)
- Specified by:
get
in interfacejava.util.Map<S,T>
- Overrides:
get
in classjava.util.AbstractMap<java.lang.String,T>
-
remove
public T remove(java.lang.Object key)
- Specified by:
remove
in interfacejava.util.Map<S,T>
- Overrides:
remove
in classjava.util.AbstractMap<java.lang.String,T>
-
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKey
in interfacejava.util.Map<S,T>
- Overrides:
containsKey
in classjava.util.AbstractMap<java.lang.String,T>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Map<S,T>
- Overrides:
clear
in classjava.util.AbstractMap<java.lang.String,T>
-
-