org.graffiti.attributes
Class CompositeAttribute

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

public abstract class CompositeAttribute
extends AbstractAttribute

Interfaces a composite attribute. All user-defined attributes should extend CompositeAttribute.

Version:
$Revision: 5767 $
See Also:
Attribute

Field Summary
 
Fields inherited from interface org.graffiti.attributes.Attribute
SEPARATOR
 
Constructor Summary
CompositeAttribute(String id)
          Creates a new CompositeAttribute with the given id.
 
Method Summary
 Attribute getAttribute(String id)
          Returns the attribute with the given id.
abstract  CollectionAttribute getAttributes()
          Transforms the CompositeAttribute into the basehierarchy.
abstract  void setAttribute(String id, Attribute att)
          Sets the given attribute to the given value.
 
Methods inherited from class org.graffiti.attributes.AbstractAttribute
getAttributable, getDescription, getId, getName, getParent, getPath, setDescription, setParent, setValue, toString, toString, toXMLString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.graffiti.attributes.Attribute
getValue, setDefaultValue
 
Methods inherited from interface org.graffiti.core.DeepCopy
copy
 

Constructor Detail

CompositeAttribute

public CompositeAttribute(String id)
Creates a new CompositeAttribute with the given id.

Parameters:
id - DOCUMENT ME!
Method Detail

setAttribute

public abstract void setAttribute(String id,
                                  Attribute att)
                           throws AttributeNotFoundException,
                                  IllegalArgumentException
Sets the given attribute to the given value. The attribute that is already location path is overwritten!

Parameters:
att - the Attribute containing the new value for the value asociated with the given id.
id - the id of the attribute to be set.
Throws:
AttributeNotFoundException - if there is no value associated with the given id.
IllegalArgumentException - if att has not the appropriate type.

getAttributes

public abstract CollectionAttribute getAttributes()
Transforms the CompositeAttribute into the basehierarchy. Maps relative paths to the apropriate 'standard attributes' (e.g. IntegerAttribute, StringAttribute etc.) of the composite attribute. This representation is intended to be read-only - changes to the CollectionAttribute have no effect on the values of this CompositeAttribute.

Returns:
the values of the composite attribute in a CollectionAttribute.

getAttribute

public Attribute getAttribute(String id)
                       throws AttributeNotFoundException
Returns the attribute with the given id. Proper ids can be obtained by calling getAttributes() and then traversing the contained Attributes and calling getId() on them. The returned Attribute is intended to be read-only. Changes to the attribute have no effect on the coresponding value in the CompositeAttribute.

Parameters:
id - the id of the attribute searched for.
Returns:
the attribute with the given id.
Throws:
AttributeNotFoundException - if the searched attribute is not found.


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