Class AttributeMap<K,V>

java.lang.Object
org.x4o.sax3.io.AttributeMap<K,V>
Type Parameters:
K - The key class.
V - The value class.
All Implemented Interfaces:
Map<K,V>

public class AttributeMap<K,V> extends Object implements Map<K,V>
Maps an SAX attributes set to an Map interface.
Version:
1.0 Apr 17, 2005
Author:
Willem Cazander
  • Constructor Details

    • AttributeMap

      public AttributeMap(Attributes attributes)
      Constuctes an new AttributeMap.
      Parameters:
      attributes - The data backend of this map.
    • AttributeMap

      public AttributeMap(Attributes attributes, String uri)
      Constructes an new AttributesMap.
      Parameters:
      attributes - The data backed of this map.
      uri - The namespace of these attributes.
  • Method Details

    • setAttributes

      public void setAttributes(Attributes attributes)
      Sets the data backend of this map.
      Parameters:
      attributes - The Attributes to be used as data backend.
    • getAttributes

      public Attributes getAttributes()
      Return the data backend of this map.
      Returns:
      The data backend of attributes
    • setNameSpace

      public void setNameSpace(String uri)
      Sets the namespace uri, when set to null it is disabled(default).
      Parameters:
      uri - The namespace uri for when parsing when an certain namespace is required.
    • getNameSpace

      public String getNameSpace()
      Returns the namespace used for these attributes.
      Returns:
      The namespace uri for the attributes.
    • size

      public int size()
      Returns the size of the map.
      Specified by:
      size in interface Map<K,V>
      Returns:
      The size of the map.
    • isEmpty

      public boolean isEmpty()
      Checks if there are attributes in this map.
      Specified by:
      isEmpty in interface Map<K,V>
      Returns:
      True if there are attributes entrys in this map.
    • containsKey

      public boolean containsKey(Object key)
      Checks if there is an attributes with an certain key.
      Specified by:
      containsKey in interface Map<K,V>
      Parameters:
      key - The name of an attribute.
      Returns:
      True if the attributes excist.
    • containsValue

      public boolean containsValue(Object value)
      Checks if there is an attributes with an value.
      Specified by:
      containsValue in interface Map<K,V>
      Parameters:
      value - The value to check.
      Returns:
      True if an attributes has this value.
    • get

      public V get(Object key)
      Returns The value of an attribute.
      Specified by:
      get in interface Map<K,V>
      Parameters:
      key - The name of the attribute.
      Returns:
      The value of the attribute.
    • put

      public V put(K key, V value)
      Function not implements. because we can't add to the attributes.
      Specified by:
      put in interface Map<K,V>
      Parameters:
      key - ignored.
      value - ignored.
      Returns:
      always null
    • remove

      public V remove(Object key)
      Function not implements. because we can't remove to the attributes.
      Specified by:
      remove in interface Map<K,V>
      Parameters:
      key - ignored.
      Returns:
      always null
    • putAll

      public void putAll(Map t)
      Function not implements. because we can't add to the attributes.
      Specified by:
      putAll in interface Map<K,V>
      Parameters:
      t - ignored.
    • clear

      public void clear()
      Function not implements. because we can't clear the attributes.
      Specified by:
      clear in interface Map<K,V>
    • keySet

      public Set<K> keySet()
      Returns a new Set whith the names of the attributes.
      Specified by:
      keySet in interface Map<K,V>
      Returns:
      An set with attributes names.
    • values

      public Collection<V> values()
      Returns an Collection of the values in the attributes list.
      Specified by:
      values in interface Map<K,V>
      Returns:
      An Collection of values.
    • entrySet

      public Set entrySet()
      Returns an Set made of Map.Entry. note: This Map.Entry is not refenced by the attribute list. so changes to not reflect to this map object.
      Specified by:
      entrySet in interface Map<K,V>
      Returns:
      An entry set.
      See Also:
    • equals

      public boolean equals(Object o)
      Compares the SAX attribute list.
      Specified by:
      equals in interface Map<K,V>
      Overrides:
      equals in class Object
      Parameters:
      o - The Object to compare with.
      Returns:
      True if the object are equal.
    • hashCode

      public int hashCode()
      returns the hashCode of the attribute list.
      Specified by:
      hashCode in interface Map<K,V>
      Overrides:
      hashCode in class Object
      Returns:
      An hashCode.