org.jutil.xml.message
Interface Element

All Superinterfaces:
java.io.Serializable, VersionedObject
All Known Implementing Classes:
DefaultElement

public interface Element
extends VersionedObject


Method Summary
 void addChild(Element child)
          Add a new child Element
 Element createElement(java.lang.String name)
           
 Element createElement(java.lang.String element, java.lang.String value)
           
 java.lang.String getAttribute(java.lang.String name)
          Return the value of specified attribute.
 java.lang.String getAttribute(java.lang.String name, java.lang.String defaultValue)
          Returns the value of the attribute specified by its name as a String, or the default value if no attribute by that name exists or is empty.
 boolean getAttributeAsBoolean(java.lang.String name)
          Return the boolean value of the specified attribute contained in this node.
 boolean getAttributeAsBoolean(java.lang.String name, boolean defaultValue)
          Returns the value of the attribute specified by its name as a boolean, or the default value if no attribute by that name exists or is empty.
 double getAttributeAsDouble(java.lang.String name)
          Return the double value of the specified attribute contained in this node.
 double getAttributeAsDouble(java.lang.String name, double defaultValue)
          Returns the value of the attribute specified by its name as a double, or the default value if no attribute by that name exists or is empty.
 float getAttributeAsFloat(java.lang.String name)
          Return the float value of the specified attribute contained in this node.
 float getAttributeAsFloat(java.lang.String name, float defaultValue)
          Returns the value of the attribute specified by its name as a float, or the default value if no attribute by that name exists or is empty.
 int getAttributeAsInteger(java.lang.String name)
          Return the int value of the specified attribute contained in this node.
 int getAttributeAsInteger(java.lang.String name, int defaultValue)
          Returns the value of the attribute specified by its name as a int, or the default value if no attribute by that name exists or is empty.
 long getAttributeAsLong(java.lang.String name)
          Returns the value of the attribute specified by its name as a long.
 long getAttributeAsLong(java.lang.String name, long defaultValue)
          Returns the value of the attribute specified by its name as a long, or the default value if no attribute by that name exists or is empty.
 java.lang.String[] getAttributeNames()
          Return an array of all attribute names.
 Element getChild(java.lang.String child)
          Return a new Element instance encapsulating the specified child node.
 Element getChild(java.lang.String child, boolean create)
          Return a new Element instance encapsulating the specified child node.
 Element[] getChildren()
          Return an Element[]
 Element[] getChildren(java.lang.String name)
          Return an Element[] containing all node children with the specified name.
 java.lang.String getName()
          Return the name of the element
 java.lang.String getValue()
          Return the value of the element
 java.lang.String getValue(java.lang.String defaultValue)
          Return the value of the element
 boolean removeChild(Element child)
           
 boolean removeChildren(java.lang.String child)
           
 void setAttribute(java.lang.String name, java.lang.String value)
          Add a new XMLAttribute
 void setName(java.lang.String name)
          Set the name of the Element
 void setValue(java.lang.String value)
          Set the value of the Element
 
Methods inherited from interface org.jutil.io.VersionedObject
getVersion
 

Method Detail

getName

java.lang.String getName()
Return the name of the element

Returns:
String

setName

void setName(java.lang.String name)
Set the name of the Element

Parameters:
name - The name String

getValue

java.lang.String getValue()
Return the value of the element

Returns:
String

getValue

java.lang.String getValue(java.lang.String defaultValue)
Return the value of the element

Returns:
String

setValue

void setValue(java.lang.String value)
Set the value of the Element

Parameters:
value - The value String

addChild

void addChild(Element child)
Add a new child Element

Parameters:
child - The child Element.

getChild

Element getChild(java.lang.String child)
Return a new Element instance encapsulating the specified child node.

Parameters:
child - The name of the child node.
Returns:
Element if Element exists otherwise return null;

getChild

Element getChild(java.lang.String child,
                 boolean create)
Return a new Element instance encapsulating the specified child node.

Parameters:
child - The name of the child node.
create - Boolean flag if true create new ElementThe name of the child node.
Returns:
Element if Element exists or create is true otherwise return null;

getChildren

Element[] getChildren()
Return an Element[]
Returns:
All the child Elements, if no child Elements return an empty array return new Element[0];

getChildren

Element[] getChildren(java.lang.String name)
Return an Element[] containing all node children with the specified name.

Parameters:
name - The name of the children to get.
Returns:
The child Elements with name, if no child Elements return an empty array return new Element[0];

getAttributeNames

java.lang.String[] getAttributeNames()
Return an array of all attribute names.


setAttribute

void setAttribute(java.lang.String name,
                  java.lang.String value)
Add a new XMLAttribute

Parameters:
name - The attribute name.
value - The attribute value.

getAttribute

java.lang.String getAttribute(java.lang.String name)
Return the value of specified attribute.

Parameters:
name - The name of the attribute you ask the value of.
Returns:
String value of attribute, or null if attribute does not exist.

getAttributeAsInteger

int getAttributeAsInteger(java.lang.String name)
                          throws AttributeNotFoundException,
                                 ValueParseException
Return the int value of the specified attribute contained in this node.

Parameters:
name - The name of the attribute you ask the value of.
Returns:
int value of attribute
Throws:
AttributeNotFoundException - If no attribute with that name exists.
NumberParseException - or if conversion to int fails.
ValueParseException

getAttributeAsLong

long getAttributeAsLong(java.lang.String name)
                        throws AttributeNotFoundException,
                               ValueParseException
Returns the value of the attribute specified by its name as a long.

Parameters:
name - The name of the attribute you ask the value of.
Returns:
long value of attribute
Throws:
AttributeNotFoundException - If no attribute with that name exists.
NumberParseException - or if conversion to long fails.
ValueParseException

getAttributeAsFloat

float getAttributeAsFloat(java.lang.String name)
                          throws AttributeNotFoundException,
                                 ValueParseException
Return the float value of the specified attribute contained in this node.

Parameters:
name - The name of the attribute you ask the value of.
Returns:
float value of attribute
Throws:
AttributeNotFoundException - If no attribute with that name exists.
NumberParseException - or if conversion to float fails.
ValueParseException

getAttributeAsDouble

double getAttributeAsDouble(java.lang.String name)
                            throws AttributeNotFoundException,
                                   ValueParseException
Return the double value of the specified attribute contained in this node.

Parameters:
name - The name of the attribute you ask the value of.
Returns:
double value of attribute
Throws:
AttributeNotFoundException - If no attribute with that name exists.
NumberParseException - or if conversion to double fails.
ValueParseException

getAttributeAsBoolean

boolean getAttributeAsBoolean(java.lang.String name)
                              throws AttributeNotFoundException,
                                     ValueParseException
Return the boolean value of the specified attribute contained in this node.

Parameters:
name - The name of the attribute you ask the value of.
Returns:
boolean value of attribute
Throws:
AttributeNotFoundException - If no attribute with that name exists.
NumberParseException - or if conversion to boolean fails.
ValueParseException

getAttribute

java.lang.String getAttribute(java.lang.String name,
                              java.lang.String defaultValue)
Returns the value of the attribute specified by its name as a String, or the default value if no attribute by that name exists or is empty.

Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
String value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsInteger

int getAttributeAsInteger(java.lang.String name,
                          int defaultValue)
Returns the value of the attribute specified by its name as a int, or the default value if no attribute by that name exists or is empty.

Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
int value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsLong

long getAttributeAsLong(java.lang.String name,
                        long defaultValue)
Returns the value of the attribute specified by its name as a long, or the default value if no attribute by that name exists or is empty.

Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
long value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsFloat

float getAttributeAsFloat(java.lang.String name,
                          float defaultValue)
Returns the value of the attribute specified by its name as a float, or the default value if no attribute by that name exists or is empty.

Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
float value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsDouble

double getAttributeAsDouble(java.lang.String name,
                            double defaultValue)
Returns the value of the attribute specified by its name as a double, or the default value if no attribute by that name exists or is empty.

Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
double value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsBoolean

boolean getAttributeAsBoolean(java.lang.String name,
                              boolean defaultValue)
Returns the value of the attribute specified by its name as a boolean, or the default value if no attribute by that name exists or is empty.

Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
boolean value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

createElement

Element createElement(java.lang.String name)

createElement

Element createElement(java.lang.String element,
                      java.lang.String value)

removeChild

boolean removeChild(Element child)

removeChildren

boolean removeChildren(java.lang.String child)