org.jscience.architecture.traffic.xml
Class XMLAttribute

java.lang.Object
  extended by org.jscience.architecture.traffic.xml.XMLAttribute

public class XMLAttribute
extends java.lang.Object

Container class for attributes of a XML element. Objects have built-in encapsulation for control-characters.


Field Summary
protected  java.lang.String name
          DOCUMENT ME!
protected  java.lang.String value
          DOCUMENT ME!
 
Constructor Summary
XMLAttribute(java.lang.String name, boolean value)
          Make a new XMLAttribute.
XMLAttribute(java.lang.String name, byte value)
          Make a new XMLAttribute.
XMLAttribute(java.lang.String name, double value)
          Make a new XMLAttribute.
XMLAttribute(java.lang.String name, float value)
          Make a new XMLAttribute.
XMLAttribute(java.lang.String name, int value)
          Make a new XMLAttribute.
XMLAttribute(java.lang.String name, java.lang.String value)
          Make a new XMlAttribute.
XMLAttribute(java.lang.String name, java.lang.String value, boolean encode)
          Make a new XMLAttribute.
 
Method Summary
 boolean getBoolValue()
          DOCUMENT ME!
 byte getByteValue()
          DOCUMENT ME!
 double getDoubleValue()
          DOCUMENT ME!
 float getFloatValue()
          DOCUMENT ME!
 int getIntValue()
          DOCUMENT ME!
 long getLongValue()
          DOCUMENT ME!
 java.lang.String getName()
          DOCUMENT ME!
 java.lang.String getValue()
          DOCUMENT ME!
 java.lang.String toString()
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
DOCUMENT ME!


value

protected java.lang.String value
DOCUMENT ME!

Constructor Detail

XMLAttribute

public XMLAttribute(java.lang.String name,
                    java.lang.String value)
Make a new XMlAttribute. Encapsulate control characters from the parameters so they don't confuse our XML parser.

Parameters:
name - The name of the attribute
value - The value of the attribute

XMLAttribute

public XMLAttribute(java.lang.String name,
                    java.lang.String value,
                    boolean encode)
Make a new XMLAttribute. Choose if you want to encapsulate control chars.

Parameters:
name - The name of the attribute
value - The value of the attribute
encode - If this boolean is true, then control characters in the parameters will be encapsulated so they don't confuse our XML parser.

XMLAttribute

public XMLAttribute(java.lang.String name,
                    int value)
Make a new XMLAttribute. The value is an int

Parameters:
name - The name of the attribute
value - The value of the attribute

XMLAttribute

public XMLAttribute(java.lang.String name,
                    float value)
Make a new XMLAttribute. The value is a float

Parameters:
name - The name of the attribute
value - The value of the attribute

XMLAttribute

public XMLAttribute(java.lang.String name,
                    double value)
Make a new XMLAttribute. The value is a double

Parameters:
name - The name of the attribute
value - The value of the attribute

XMLAttribute

public XMLAttribute(java.lang.String name,
                    boolean value)
Make a new XMLAttribute. The value is a boolean

Parameters:
name - The name of the attribute
value - The value of the attribute

XMLAttribute

public XMLAttribute(java.lang.String name,
                    byte value)
Make a new XMLAttribute. The value is a byte

Parameters:
name - The name of the attribute
value - The value of the attribute
Method Detail

toString

public java.lang.String toString()
DOCUMENT ME!

Overrides:
toString in class java.lang.Object
Returns:
A string with name="value". With eventual encapsulation.

getName

public java.lang.String getName()
DOCUMENT ME!

Returns:
The name of this attribute

getValue

public java.lang.String getValue()
DOCUMENT ME!

Returns:
The value of this attribute

getIntValue

public int getIntValue()
                throws XMLInvalidInputException
DOCUMENT ME!

Returns:
Tries to convert the value of this attribute to an int and returns it
Throws:
XMLInvalidInputException - If the value of this attribute cannot be converted to an int.

getLongValue

public long getLongValue()
                  throws XMLInvalidInputException
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
XMLInvalidInputException - DOCUMENT ME!

getBoolValue

public boolean getBoolValue()
                     throws XMLInvalidInputException
DOCUMENT ME!

Returns:
Tries to convert the value of this attribute to a boolean and returns it
Throws:
XMLInvalidInputException - If the value of this attribute cannot be converted to a boolean.

getFloatValue

public float getFloatValue()
                    throws XMLInvalidInputException
DOCUMENT ME!

Returns:
Tries to convert the value of this attribute to a float and returns it
Throws:
XMLInvalidInputException - If the value of this attribute cannot be converted to a float.

getDoubleValue

public double getDoubleValue()
                      throws XMLInvalidInputException
DOCUMENT ME!

Returns:
Tries to convert the value of this attribute to a double and returns it
Throws:
XMLInvalidInputException - If the value of this attribute cannot be converted to a double.

getByteValue

public byte getByteValue()
                  throws XMLInvalidInputException
DOCUMENT ME!

Returns:
Tries to convert the value of this attribute to a byte and returns it
Throws:
XMLInvalidInputException - If the value of this attribute cannot be converted to a byte.