de.intarsys.tools.attribute
Class AttributeMap

java.lang.Object
  extended by de.intarsys.tools.attribute.AttributeMap
All Implemented Interfaces:
IAttributeSupport

public final class AttributeMap
extends java.lang.Object
implements IAttributeSupport

A default implementation for IAttributeSupport. The API is "doubled" to be usable as a simple replacement for a Map.

The keys are looked up using object identity!


Constructor Summary
AttributeMap()
           
AttributeMap(int initialCapacity)
           
 
Method Summary
 void clear()
           
 java.lang.Object get(java.lang.Object key)
           
 java.lang.Object getAttribute(java.lang.Object key)
          Get an attribute value from the context
 java.lang.Object[] getKeys()
          The keys used in this attribute lookup map.
 java.lang.Object put(java.lang.Object key, java.lang.Object o)
           
 java.lang.Object remove(java.lang.Object key)
           
 java.lang.Object removeAttribute(java.lang.Object key)
          Remove an attribute binding in the context
 java.lang.Object setAttribute(java.lang.Object key, java.lang.Object value)
          Set the value of an attribute in the context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeMap

public AttributeMap()

AttributeMap

public AttributeMap(int initialCapacity)
Method Detail

clear

public void clear()

get

public java.lang.Object get(java.lang.Object key)

getAttribute

public java.lang.Object getAttribute(java.lang.Object key)
Description copied from interface: IAttributeSupport
Get an attribute value from the context

Specified by:
getAttribute in interface IAttributeSupport
Parameters:
key - the name of the attribute to get
Returns:
The value of the attribute key

getKeys

public java.lang.Object[] getKeys()
The keys used in this attribute lookup map.

!! This is not intended to be published to client code, as this would compromise IAttributeSupport security !!

Returns:
The keys used in this attribute lookup map.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object o)

remove

public java.lang.Object remove(java.lang.Object key)

removeAttribute

public java.lang.Object removeAttribute(java.lang.Object key)
Description copied from interface: IAttributeSupport
Remove an attribute binding in the context

Specified by:
removeAttribute in interface IAttributeSupport
Parameters:
key - the name of the attribute to remove
Returns:
The previously associated value for key

setAttribute

public java.lang.Object setAttribute(java.lang.Object key,
                                     java.lang.Object value)
Description copied from interface: IAttributeSupport
Set the value of an attribute in the context

Specified by:
setAttribute in interface IAttributeSupport
Parameters:
key - the name of the attribute to set
value - the new value the attribute
Returns:
The previously associated value for key