org.graffiti.attributes
Class LinkedHashMapAttribute

java.lang.Object
  extended by org.graffiti.attributes.AbstractAttribute
      extended by org.graffiti.attributes.AbstractCollectionAttribute
          extended by org.graffiti.attributes.LinkedHashMapAttribute
All Implemented Interfaces:
Attribute, CollectionAttribute, SortedCollectionAttribute, DeepCopy, Displayable<Object>

public class LinkedHashMapAttribute
extends AbstractCollectionAttribute
implements SortedCollectionAttribute

DOCUMENT ME!

Version:
$Revision: 5767 $

Field Summary
 
Fields inherited from interface org.graffiti.attributes.Attribute
SEPARATOR
 
Constructor Summary
LinkedHashMapAttribute(String id)
          Construct a new instance of a LinkedHashMapAttribute.
 
Method Summary
 Object copy()
          Copies this CollectionAttribute and returns the copy.
 Map<String,Attribute> getCollection()
          Returns a cloned map (shallow copy of map: i.e.
 void setCollection(Map<String,Attribute> attrs)
          Sets the collection of attributes contained within this CollectionAttribute For each entry in the map, pre- and post- AttributeAdded events are generated since method add(Attribute a) is called for each attribute in the map.
 void setDefaultValue()
          Already done in constructor for this attribute type.
 String toXMLString()
          Returns a well-formed XML string representing the Displayable.
 
Methods inherited from class org.graffiti.attributes.AbstractCollectionAttribute
add, add, containsAttribute, getAttributable, getAttribute, getValue, isEmpty, remove, remove, setAttributable, toString
 
Methods inherited from class org.graffiti.attributes.AbstractAttribute
getDescription, getId, getName, getParent, getPath, setDescription, setParent, setValue, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.graffiti.attributes.CollectionAttribute
add, add, containsAttribute, getAttribute, isEmpty, remove, remove, setAttributable
 
Methods inherited from interface org.graffiti.attributes.Attribute
getAttributable, getId, getParent, getPath, getValue, setParent, setValue, toString
 
Methods inherited from interface org.graffiti.plugin.Displayable
getDescription, getName, setDescription
 

Constructor Detail

LinkedHashMapAttribute

public LinkedHashMapAttribute(String id)
Construct a new instance of a LinkedHashMapAttribute. The internal LinkedHashMap is initialized empty.

Parameters:
id - the id of the attribute.
Method Detail

setCollection

public void setCollection(Map<String,Attribute> attrs)
Sets the collection of attributes contained within this CollectionAttribute For each entry in the map, pre- and post- AttributeAdded events are generated since method add(Attribute a) is called for each attribute in the map.

Specified by:
setCollection in interface CollectionAttribute
Parameters:
attrs - the Map that contains all attributes.

getCollection

public Map<String,Attribute> getCollection()
Returns a cloned map (shallow copy of map: i.e. this.map.equals(getCollection())but not this.map == getCollection()) between attributes' ids and attributes contained in this CollectionAttribute.

Specified by:
getCollection in interface CollectionAttribute
Returns:
a clone of the list of attributes in this CollectionAttribute.

setDefaultValue

public void setDefaultValue()
Already done in constructor for this attribute type.

Specified by:
setDefaultValue in interface Attribute
See Also:
Attribute.setDefaultValue()

copy

public Object copy()
Copies this CollectionAttribute and returns the copy. All sub-attributes will be copied, too, i.e. a deep-copy is returned.

Specified by:
copy in interface DeepCopy
Returns:
a copy of the CollectionAttribute.

toXMLString

public String toXMLString()
Description copied from interface: Displayable
Returns a well-formed XML string representing the Displayable. The Displayable should be reconstructable via this representation. Therefore it must at least include the type of Displayable (classname) and a representation of its value. PROBABLE FUTURE DESIGN: The Displayables themselves will provide a method to reconstruct their value from the XML representation they provided.

Specified by:
toXMLString in interface Displayable<Object>
Overrides:
toXMLString in class AbstractCollectionAttribute
Returns:
string holding an XML representation of this Displayable
See Also:
Displayable.toXMLString()


Generated at 2012-05-30 11:00:14 PM CEST