Class AttributeMap
- java.lang.Object
-
- org.pentaho.reporting.libraries.xmlns.common.AttributeMap
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class AttributeMap extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable
A attribute map holding <namspace;name>-value pairs.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AttributeMap()
Default constructor.AttributeMap(AttributeMap copy)
Creates a new attibute map using the given parameter as source for the initial values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Creates a copy of this map.boolean
equals(java.lang.Object o)
java.lang.Object
getAttribute(java.lang.String namespace, java.lang.String attribute)
Returns the attribute value for the given namespace and attribute-name.java.util.Map
getAttributes(java.lang.String namespace)
Returns all attributes of the given namespace as unmodifable map.java.lang.Object
getFirstAttribute(java.lang.String attribute)
Looks up all namespaces and returns the value from the first namespace that has this attribute defined.java.lang.String[]
getNames(java.lang.String namespace)
Returns all names for the given namespace that have values in this map.java.lang.String[]
getNameSpaces()
Returns all namespaces that have values in this map.int
hashCode()
void
putAll(AttributeMap attributeMap)
java.lang.Object
setAttribute(java.lang.String namespace, java.lang.String attribute, java.lang.Object value)
Defines the attribute for the given namespace and attribute name.
-
-
-
Constructor Detail
-
AttributeMap
public AttributeMap()
Default constructor.
-
AttributeMap
public AttributeMap(AttributeMap copy)
Creates a new attibute map using the given parameter as source for the initial values.- Parameters:
copy
- the attribute map that should be copied.
-
-
Method Detail
-
clone
public java.lang.Object clone()
Creates a copy of this map.- Returns:
- the clone.
-
setAttribute
public java.lang.Object setAttribute(java.lang.String namespace, java.lang.String attribute, java.lang.Object 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 java.lang.Object getAttribute(java.lang.String namespace, java.lang.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 java.lang.Object getFirstAttribute(java.lang.String attribute)
Looks up all namespaces and returns the value from the first namespace that has this attribute defined. As the order of the namespaces is not defined, this returns a random value and the namespace used is undefined if more than one namespace contains the same attribute.- 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 java.util.Map getAttributes(java.lang.String namespace)
Returns all attributes of the given namespace as unmodifable map.- Parameters:
namespace
- the namespace for which the attributes should be returned.- Returns:
- the map, never null.
-
getNames
public java.lang.String[] getNames(java.lang.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.
-
getNameSpaces
public java.lang.String[] getNameSpaces()
Returns all namespaces that have values in this map.- Returns:
- the namespaces stored in this map.
-
putAll
public void putAll(AttributeMap attributeMap)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-