Package org.sourceid.util.log
Class AttributeMap
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,AttributeValue>
An attribute map that maps the name of the attribute to the
AttributeValue. The class extends HashMap
and should be treated as such.- See Also:
-
Nested Class Summary
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
ConstructorsConstructorDescriptionCreate an empty AttributeMapAttributeMap(Map<String, AttributeValue> attributes) Create an AttributeMap based on the specified map -
Method Summary
Modifier and TypeMethodDescriptionGets the names of the attributes in this map that are flagged as masked.booleanGets whether the OGNL values should be masked.getSingleValue(String name) Gets the value associated with the specified attribute name.getSingleValue(String name, boolean enforceMasking) Gets the real or masked value associated with the specified attribute name.voidAdds a key value pair to this map.put(String key, AttributeValue value) Adds theAttributeValueto this map.voidputAll(Map<? extends String, ? extends AttributeValue> m) Copies all of the mappings from the specified map to this map.voidputIfNotPresent(String key, AttributeValue value) Puts the key/value entry if the key doesn't already exist in this map.voidsetMaskOgnlValues(boolean maskOgnlValues) Sets whether the OGNL values should be masked.toString()static StringtoString(Map<String, AttributeValue> map) Static method to stringify the specified map.Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode
-
Constructor Details
-
AttributeMap
Create an AttributeMap based on the specified map- Parameters:
attributes- A map containing the attributes to add
-
AttributeMap
public AttributeMap()Create an empty AttributeMap
-
-
Method Details
-
put
Adds a key value pair to this map. The value is wrapped by anAttributeValueand added withput(String, AttributeValue).- Parameters:
key- The key with which the specified value is to be associated.value- The value to be associated with the specified key.
-
putAll
Copies all of the mappings from the specified map to this map. These mappings will replace any mappings that this map had for any of the keys currently in the specified map.- Specified by:
putAllin interfaceMap<String,AttributeValue> - Overrides:
putAllin classHashMap<String,AttributeValue> - Parameters:
m- mappings to be stored in this map- Throws:
NullPointerException- if the specified map is null
-
put
Adds theAttributeValueto this map. The entry is not added if the value is null.- Specified by:
putin interfaceMap<String,AttributeValue> - Overrides:
putin classHashMap<String,AttributeValue> - Parameters:
key- Key with which the specified value is to be associated.value- Value to be associated with the specified key.- Returns:
- The previous value associated with key, or null if there was no mapping for key or the passed-in value is null.
-
putIfNotPresent
Puts the key/value entry if the key doesn't already exist in this map.- Parameters:
key- The key to put if it doesn't already exist in the map.value- The value to put if the key doesn't already exist in the map.
-
toString
Static method to stringify the specified map.- Parameters:
map- The map to convert to a String.- Returns:
- A String representation of the map.
-
toString
- Overrides:
toStringin classAbstractMap<String,AttributeValue>
-
getMaskedAttributeNames
Gets the names of the attributes in this map that are flagged as masked.- Returns:
- The set of attribute names that are flagged to be masked.
-
getSingleValue
Gets the value associated with the specified attribute name. If the value is a multi-value attribute, the first value is returned.- Parameters:
name- The name of the attribute to look up.- Returns:
- The value associated with the specified attribute name. If the value is a multi-value attribute, the first value is returned. Returns null if the attribute does not exist.
-
getSingleValue
Gets the real or masked value associated with the specified attribute name. If the value is a multi-value attribute, the first value is returned.- Parameters:
name- The name of the attribute to lookup.enforceMasking- Whether the returned value should be masked if the attribute is flagged for masking.- Returns:
- The value associated with the specified attribute name. If the value is a multi-value attribute, the first value is returned. Can also return a masked value if enforceMasking and attribute masking is set to true. Returns null if the attribute does not exist.
-
getMaskOgnlValues
public boolean getMaskOgnlValues()Gets whether the OGNL values should be masked.- Returns:
- True, if the OGNL values should be masked.
-
setMaskOgnlValues
public void setMaskOgnlValues(boolean maskOgnlValues) Sets whether the OGNL values should be masked.- Parameters:
maskOgnlValues- Whether the OGNL values should be masked.
-