Class AttributeMap<T>

java.lang.Object
org.pentaho.reporting.libraries.xmlns.common.AttributeMap<T>
All Implemented Interfaces:
Serializable, Cloneable

public class AttributeMap<T> extends Object implements Serializable, Cloneable
A attribute map holding <namespace;name>-value pairs.
Author:
Thomas Morgner
See Also:
  • Constructor Details

    • AttributeMap

      public AttributeMap()
      Default constructor.
    • AttributeMap

      public AttributeMap(AttributeMap copy)
      Creates a new attribute map using the given parameter as source for the initial values.
      Parameters:
      copy - the attribute map that should be copied.
  • Method Details

    • clone

      public AttributeMap<T> clone()
      Creates a copy of this map.
      Overrides:
      clone in class Object
      Returns:
      the clone.
    • setAttribute

      public T setAttribute(String namespace, String attribute, T value)
      Defines the attribute for the given namespace and attribute name.
      Parameters:
      namespace - the namespace under which the value should be stored.
      attribute - the attribute name under which the value should be stored within the namespace.
      value - the value.
      Returns:
      the previously stored value at that position.
    • getAttribute

      public T getAttribute(String namespace, String attribute)
      Returns the attribute value for the given namespace and attribute-name.
      Parameters:
      namespace - the namespace.
      attribute - the attribute name.
      Returns:
      the value or null, if there is no such namespace/attribute name combination.
    • getFirstAttribute

      public T getFirstAttribute(String attribute)
      Looks up all namespaces and returns the value from the first namespace that has this attribute defined.
      Parameters:
      attribute - the the attribute name.
      Returns:
      the object from the first namespace that carries this attribute or null, if none of the namespaces has such an attribute defined.
    • getAttributes

      public Map<String,T> getAttributes(String namespace)
      Returns all attributes of the given namespace as unmodifiable map.
      Parameters:
      namespace - the namespace for which the attributes should be returned.
      Returns:
      the map, never null.
    • getNames

      public String[] getNames(String namespace)
      Returns all names for the given namespace that have values in this map.
      Parameters:
      namespace - the namespace for which known attribute names should be looked up.
      Returns:
      the names stored for the given namespace.
    • keySet

      public Set<AttributeMap.DualKey> keySet()
    • getNameSpaces

      public String[] getNameSpaces()
      Returns all namespaces that have values in this map.
      Returns:
      the namespaces stored in this map.
    • putAll

      public void putAll(AttributeMap<T> attributeMap)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clear

      public void clear()