Class AttributeMap

All Implemented Interfaces:
Serializable, Cloneable, Map<String,AttributeValue>

public class AttributeMap extends HashMap<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:
  • Constructor Details

    • AttributeMap

      public AttributeMap(Map<String,AttributeValue> attributes)
      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

      public void put(String key, String value)
      Adds a key value pair to this map. The value is wrapped by an AttributeValue and added with put(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

      public void putAll(Map<? extends String,? extends AttributeValue> m)
      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:
      putAll in interface Map<String,AttributeValue>
      Overrides:
      putAll in class HashMap<String,AttributeValue>
      Parameters:
      m - mappings to be stored in this map
      Throws:
      NullPointerException - if the specified map is null
    • put

      public AttributeValue put(String key, AttributeValue value)
      Adds the AttributeValue to this map. The entry is not added if the value is null.
      Specified by:
      put in interface Map<String,AttributeValue>
      Overrides:
      put in class HashMap<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

      public void putIfNotPresent(String key, AttributeValue value)
      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

      public static String toString(Map<String,AttributeValue> map)
      Static method to stringify the specified map.
      Parameters:
      map - The map to convert to a String.
      Returns:
      A String representation of the map.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractMap<String,AttributeValue>
    • getMaskedAttributeNames

      public Set<String> 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

      public String getSingleValue(String name)
      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

      public String getSingleValue(String name, boolean enforceMasking)
      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.