org.inria.ns.reflex.xml.sax
Class AttributesMap

java.lang.Object
  extended by org.xml.sax.helpers.AttributesImpl
      extended by org.inria.ns.reflex.xml.sax.AttributesMap
All Implemented Interfaces:
Map, Attributes

public class AttributesMap
extends AttributesImpl
implements Map

A map of SAX attributes.

Just for adding a map view of the underlying attribute set.

Author:
Philippe Poulard
See Also:
MapOfNamedNode

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
AttributesMap()
          Create a new empty map of attributes.
AttributesMap(Attributes attributes)
          Create a new map of attributes.
AttributesMap(Map attributes)
          Create a new map of attributes.
 
Method Summary
 boolean containsKey(Object key)
          Indicates whether this map contains the given key or not.
 boolean containsValue(Object value)
          Lookup for a value.
 Set entrySet()
          Return the set of attributes contained in this map.
 Object get(Object name)
          Return the value of the attribute that has the name given.
 boolean isEmpty()
          Indicates whether this map is empty or not.
 Set keySet()
          Return the set of attribute names contained in this map.
 Object put(Object name, Object value)
          Put an attribute in this map.
 void putAll(Map attributes)
          Put all attributes of the given map in this map.
 Object remove(Object name)
          Remove the attribute that has the name given.
 int size()
          Return the number of attributes contained in this map.
 Collection values()
          Return the set of attribute values contained in this map.
 
Methods inherited from class org.xml.sax.helpers.AttributesImpl
addAttribute, clear, getIndex, getIndex, getLength, getLocalName, getQName, getType, getType, getType, getURI, getValue, getValue, getValue, removeAttribute, setAttribute, setAttributes, setLocalName, setQName, setType, setURI, setValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, equals, hashCode
 

Constructor Detail

AttributesMap

public AttributesMap(Attributes attributes)
Create a new map of attributes.

Parameters:
attributes - The attributes to copy in this map.

AttributesMap

public AttributesMap(Map attributes)
Create a new map of attributes.

Parameters:
attributes - The attributes to copy in this map.
See Also:
putAll(Map)

AttributesMap

public AttributesMap()
Create a new empty map of attributes.

Method Detail

size

public int size()
Return the number of attributes contained in this map.

Specified by:
size in interface Map
Returns:
The number of attributes contained in this map.
See Also:
Attributes.getLength()

isEmpty

public boolean isEmpty()
Indicates whether this map is empty or not.

Specified by:
isEmpty in interface Map
Returns:
true if there is no attribute in this map, false otherwise.

containsKey

public boolean containsKey(Object key)
Indicates whether this map contains the given key or not.

Specified by:
containsKey in interface Map
Parameters:
key - The key to look for.
Returns:
true if the key is in this map, false otherwise.
See Also:
get(Object)

containsValue

public boolean containsValue(Object value)
Lookup for a value.

Specified by:
containsValue in interface Map
Parameters:
value - The value to look for, which can be converted to a String if necessary.
Returns:
true if the value is in this map, false otherwise.

get

public Object get(Object name)
Return the value of the attribute that has the name given.

Specified by:
get in interface Map
Parameters:
name - The name of the attribute to look for. Can be a String or a QName.
Returns:
The string value of the attribute, or null.
See Also:
QName

put

public Object put(Object name,
                  Object value)
Put an attribute in this map.

Specified by:
put in interface Map
Parameters:
name - The name of the attribute. Can be a String or a QName.
value - The value of the attribute, which can be converted to a String if necessary.
Returns:
The old String value of the attribute, or null.
See Also:
QName

remove

public Object remove(Object name)
Remove the attribute that has the name given.

Specified by:
remove in interface Map
Parameters:
name - The name of the attribute to remove. Can be a String or a QName.
Returns:
The old String value of the attribute, or null.
See Also:
QName

putAll

public void putAll(Map attributes)
Put all attributes of the given map in this map.

Specified by:
putAll in interface Map
Parameters:
attributes - The attributes to put in this map.
See Also:
put(Object, Object)

keySet

public Set keySet()
Return the set of attribute names contained in this map.

Specified by:
keySet in interface Map
Parameters:
A - set of QName.
See Also:
QName

values

public Collection values()
Return the set of attribute values contained in this map.

Specified by:
values in interface Map
Parameters:
A - collection of String.

entrySet

public Set entrySet()
Return the set of attributes contained in this map.

Specified by:
entrySet in interface Map
Parameters:
A - set of Map.Entry which key is a QName and value is a String.
See Also:
QName, Map