Copyright @ 2002 SAP. All Rights Reserved.

com.sap.tc.complib
Interface PropertyElement

All Known Subinterfaces:
Property

public interface PropertyElement

This class represents a child element of a structured property of a development component. The PropertyElement class allows to build simple DOM-like trees by adding children to PropertyElement instances. Note, currently properties with "mixed" values, i.e. that consist of text fragments with interspersed tags, are not supported.


Method Summary
 PropertyElement addChild(java.lang.String childName)
          Adds a new child to this element.
 PropertyElement addChild(java.lang.String childName, java.lang.String value)
          Adds a new child to this element.
 int countChildren()
          Returns the number of children of this element.
 void emptyChildren()
          Removes all children of this element.
 PropertyElement firstChild()
          Returns the first child of this element.
 Attribute[] getAttributes()
           
 PropertyElement getChild(java.lang.String childName)
          Returns the child specified by its name.
 java.util.Iterator getChildren()
          Returns the children of this element.
 java.lang.String getChildValue(java.lang.String childName)
          Returns the value of a child of this element specified by its name.
 java.lang.String[] getChildValues()
          Returns the simple values of all children of this element.
 java.lang.String getName()
          Returns the name of this property element.
 java.lang.String getNamespace()
           
 java.lang.String getNamespacePrefix()
           
 PropertyElement getParent()
          Returns the parent of this element.
 java.lang.String getQName()
           
 java.lang.String getValue()
          Returns the simple value of this property element, or null if the element has children, or no value has been defined for the element.
 PropertyElement lastChild()
          Returns the last child of this element.
 PropertyElement next()
          Returns the successor of this element.
 void setAttribute(java.lang.String name, java.lang.String value)
           
 void setAttributes(java.util.List attributes)
           
 void setName(java.lang.String name)
          Sets the name of this property element.
 void setNamespace(java.lang.String namespaceURI)
           
 void setNamespace(java.lang.String prefix, java.lang.String namespaceURI)
           
 void setValue(java.lang.String value)
          Sets the simple value of this property element.
 

Method Detail

getName

public java.lang.String getName()
Returns the name of this property element. Note, property elements always are in the same namespace as the property to which they belong.
Returns:
the name of this element.

setName

public void setName(java.lang.String name)
Sets the name of this property element.
Parameters:
name - the new name of this element.

getQName

public java.lang.String getQName()
Returns:
 

getNamespacePrefix

public java.lang.String getNamespacePrefix()
Returns:
 

getNamespace

public java.lang.String getNamespace()
Returns:
 

setNamespace

public void setNamespace(java.lang.String namespaceURI)
Parameters:
namespaceURI -  

setNamespace

public void setNamespace(java.lang.String prefix,
                         java.lang.String namespaceURI)
Parameters:
prefix -  
namespaceURI -  

getValue

public java.lang.String getValue()
Returns the simple value of this property element, or null if the element has children, or no value has been defined for the element.
Returns:
the value of this element.

setValue

public void setValue(java.lang.String value)
Sets the simple value of this property element. Note, if the element has children these children are removed.
Parameters:
value - the new value of this element.

getAttributes

public Attribute[] getAttributes()
Returns:
 

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
Parameters:
name -  
value -  

setAttributes

public void setAttributes(java.util.List attributes)
Parameters:
attributes -  

countChildren

public int countChildren()
Returns the number of children of this element.
Returns:
The number of children of this element.

firstChild

public PropertyElement firstChild()
Returns the first child of this element.
Returns:
The first child of this element.

lastChild

public PropertyElement lastChild()
Returns the last child of this element.
Returns:
The last child of this element.

next

public PropertyElement next()
Returns the successor of this element.
Returns:
The successor of this element.

getParent

public PropertyElement getParent()
Returns the parent of this element.
Returns:
The parent of this element, or null if the property element has no parent.

getChildren

public java.util.Iterator getChildren()
Returns the children of this element.
Returns:
An enumeration of PropertyElement instances representing the children of this element.

emptyChildren

public void emptyChildren()
Removes all children of this element.

addChild

public PropertyElement addChild(java.lang.String childName)
Adds a new child to this element.
Parameters:
childName - the name of the child element to add.
Returns:
a reference to the new PropertyElement instance.

addChild

public PropertyElement addChild(java.lang.String childName,
                                java.lang.String value)
Adds a new child to this element.
Parameters:
childName - the name of the child element to add.
value - the initial simple value of the new child.
Returns:
a reference to the new PropertyElement instance.

getChild

public PropertyElement getChild(java.lang.String childName)
Returns the child specified by its name.
Parameters:
childName - the name of the child.
Returns:
the child corresponding to the given name, or null if no child with the given name exists or this element has no children.

getChildValue

public java.lang.String getChildValue(java.lang.String childName)
Returns the value of a child of this element specified by its name.
Parameters:
childName - the name of the child.
Returns:
The simple value of the specified child, or null if no child with the given name exists or this element has no children.

getChildValues

public java.lang.String[] getChildValues()
Returns the simple values of all children of this element. This method is useful to access list- or set-like properties. Children not defining a simple value are ignored.
Returns:
A string array with the simple values of the children of this element. If the element has no children, or none of the children defines a simple value, an empty array is returned.

Copyright @ 2002 SAP. All Rights Reserved.