org.palo.api
Interface Attribute


public interface Attribute

Atributes are used to provide extra informations for an Element of a Dimension. Each Element can have several distinct attributes.

With the setChildren(Attribute[]) method it is possible to build up an hierarchy of Attributes.

Version:
$Id: Attribute.html,v 1.19 2009/07/09 11:01:46 ArndHouben Exp $

Field Summary
static int TYPE_NUMERIC
           
static int TYPE_STRING
           
 
Method Summary
 Attribute[] getChildren()
          Returns the children of this attribute
 java.lang.String getId()
          The unique attribute identifier
 java.lang.String getName()
          The attribute name
 Attribute[] getParents()
          Returns the parent attributes of this attribute
 int getType()
          Returns the attribute type which is one of the defined type constants
 java.lang.Object getValue(Element element)
          Returns the attribute value for the given Element instance.
 java.lang.Object[] getValues(Element[] elements)
          Convenient method to receive the values for several Elements at once.
 boolean hasChildren()
          Checks if this attribute has any children attributes.
 void removeChildren(Attribute[] attributes)
          Convenient method to remove children attributes from this attribute
 void setChildren(Attribute[] attributes)
          Sets the children attributes of this attribute.
 void setName(java.lang.String name)
          Sets the attribute name
 void setValue(Element element, java.lang.Object value)
          Sets the attribute value for the given Element instance.
 void setValues(Element[] elements, java.lang.Object[] values)
          Convenient method to set the values for several Elements at once, i.e. the attribute value for the i.th element is set to the i.th object.
 

Field Detail

TYPE_STRING

static final int TYPE_STRING
See Also:
Constant Field Values

TYPE_NUMERIC

static final int TYPE_NUMERIC
See Also:
Constant Field Values
Method Detail

getId

java.lang.String getId()
The unique attribute identifier

Returns:
the unique identifier of the attribute

getName

java.lang.String getName()
The attribute name

Returns:
the name of the attribute

setName

void setName(java.lang.String name)
Sets the attribute name

Parameters:
name - the new attribute name

getValue

java.lang.Object getValue(Element element)
Returns the attribute value for the given Element instance.

Parameters:
element - the Element to get the attribute value from
Returns:
the attribute value or null if the value is not specified

setValue

void setValue(Element element,
              java.lang.Object value)
Sets the attribute value for the given Element instance.

Parameters:
element - the Element which attribute value to set
value - the new attribute value

setValues

void setValues(Element[] elements,
               java.lang.Object[] values)
Convenient method to set the values for several Elements at once, i.e. the attribute value for the i.th element is set to the i.th object.

Parameters:
elements - the elements to set the values for
values - the new values

getValues

java.lang.Object[] getValues(Element[] elements)
Convenient method to receive the values for several Elements at once.

Parameters:
elements - the elements to get the values from
Returns:
the attribute values for the given elements

hasChildren

boolean hasChildren()
Checks if this attribute has any children attributes.

Returns:
true if the attribute has children, false otherwise.

setChildren

void setChildren(Attribute[] attributes)
Sets the children attributes of this attribute.

Note: this will remove all previously set children. Specifying null is allowed and will remove all children!

Parameters:
attributes - the attribute children

removeChildren

void removeChildren(Attribute[] attributes)
Convenient method to remove children attributes from this attribute

Parameters:
attributes - attribute children to remove

getChildren

Attribute[] getChildren()
Returns the children of this attribute

Returns:
an array of children attributes

getParents

Attribute[] getParents()
Returns the parent attributes of this attribute

Returns:
an array of parent attributes

getType

int getType()
Returns the attribute type which is one of the defined type constants

Returns:
attribute type