xtom.parser
Class Attribute

java.lang.Object
  extended byxtom.parser.Attribute

public class Attribute
extends java.lang.Object

Description:this calss is a container for the attributes in the XMl element. It only has two fields and getter methods for them. You can not change the value or the name of this Attribute.

Version:
$Revision: 1.1 $
Author:
taras

Field Summary
private  java.lang.String name
           
private  java.lang.String value
           
 
Constructor Summary
private Attribute()
           
  Attribute(java.lang.String name, java.lang.String value)
          Creates a new attribute.
BY DEFAULT - names of the attributes are case sensitive
 
Method Summary
 java.lang.String getName()
           
 java.lang.String getValue()
           
 boolean getValueAsBoolean()
          Returns value parsed as a boolean.
 byte getValueAsByte()
          Returns value parsed as a byte.
 char getValueAsCharacter()
          Returns value parsed as a char.
 double getValueAsDouble()
          Returns value parsed as a double.
 float getValueAsFloat()
          Returns value parsed as a float.
 int getValueAsInt()
          Returns value parsed as an int.
 long getValueAsLong()
          Returns value parsed as a float.
 short getValueAsShort()
          Returns value parsed as a short.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name

value

private java.lang.String value
Constructor Detail

Attribute

private Attribute()

Attribute

public Attribute(java.lang.String name,
                 java.lang.String value)
Creates a new attribute.
BY DEFAULT - names of the attributes are case sensitive

Parameters:
name - The name of the attribute
value - The value of this attribute.
Throws:
java.lang.IllegalArgumentException - If the name string is null or length < 1.
Method Detail

getName

public java.lang.String getName()
Returns:
Returns the name.

getValue

public java.lang.String getValue()
Returns:
Returns the value.

toString

public java.lang.String toString()
See Also:
Object.toString()

getValueAsInt

public int getValueAsInt()
Returns value parsed as an int. If the parsing fails it will throw a NumberFormatException

Throws:
java.lang.NumberFormatException - is it can not parse the value.

getValueAsFloat

public float getValueAsFloat()
Returns value parsed as a float. If the parsing fails it will throw a NumberFormatException

Throws:
java.lang.NumberFormatException - is it can not parse the value.

getValueAsDouble

public double getValueAsDouble()
Returns value parsed as a double. If the parsing fails it will throw a NumberFormatException

Throws:
java.lang.NumberFormatException - is it can not parse the value.

getValueAsShort

public short getValueAsShort()
Returns value parsed as a short. If the parsing fails it will throw a NumberFormatException

Throws:
java.lang.NumberFormatException - is it can not parse the value.

getValueAsLong

public long getValueAsLong()
Returns value parsed as a float. If the parsing fails it will throw a NumberFormatException

Throws:
java.lang.NumberFormatException - is it can not parse the value.

getValueAsByte

public byte getValueAsByte()
Returns value parsed as a byte. If the parsing fails it will throw a NumberFormatException

Throws:
java.lang.NumberFormatException - is it can not parse the value.

getValueAsBoolean

public boolean getValueAsBoolean()
Returns value parsed as a boolean. If the parsing fails it will throw a NumberFormatException If the string = 'true', returns true, Returns false otherwise.

Throws:
java.lang.NumberFormatException - is it can not parse the value.
See Also:
Boolean.valueOf(java.lang.String)

getValueAsCharacter

public char getValueAsCharacter()
Returns value parsed as a char. If the parsing fails it will throw a NumberFormatException

Throws:
java.lang.NumberFormatException - is it can not parse the value.