kirk.io.sdl
Class SDLDataElement

java.lang.Object
  extended bykirk.io.sdl.SDLElement
      extended bykirk.io.sdl.SDLDataElement

public class SDLDataElement
extends SDLElement

This class represents the data element of an SDL document. It has a name and a data (text) value.

Version:
1
Author:
Berend "Kirk" Wouda

Field Summary
static String IDENTIFIER
          The identifier of the data element type.
protected  String value
          The data value of this element.
 
Fields inherited from class kirk.io.sdl.SDLElement
name
 
Constructor Summary
SDLDataElement(String name, String value)
          Constructs a new data element with the given name and value.
 
Method Summary
 String getValue()
          Returns the value of this element.
 Boolean getValueAsBoolean()
          Returns the value of this element as a Boolean.
 Byte getValueAsByte()
          Returns the value of this element as a Byte.
 Character getValueAsCharacter()
          Returns the value of this element as a Character.
 Double getValueAsDouble()
          Returns the value of this element as an Double.
 Float getValueAsFloat()
          Returns the value of this element as an Float.
 Integer getValueAsInteger()
          Returns the value of this element as an Integer.
 Long getValueAsLong()
          Returns the value of this element as an Long.
 Short getValueAsShort()
          Returns the value of this element as a Short.
 String getValueAsString()
          Returns the value of this element as a String.
 StringBuffer getValueAsStringBuffer()
          Returns the value of this element as a StringBuffer.
 void setValue(String value)
          Sets the value to the given value.
 String toString(String indent)
          Returns a string representation of this SDLDataElement with the given indentation.
 
Methods inherited from class kirk.io.sdl.SDLElement
getAsDataElement, getAsNormalElement, getName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected String value
The data value of this element.


IDENTIFIER

public static final String IDENTIFIER
The identifier of the data element type.

See Also:
Constant Field Values
Constructor Detail

SDLDataElement

public SDLDataElement(String name,
                      String value)
Constructs a new data element with the given name and value.

Parameters:
name - The name of the element.
value - The value of the element.
Method Detail

setValue

public void setValue(String value)
Sets the value to the given value.

Parameters:
value - The new value of this element.

getValue

public String getValue()
Returns the value of this element.

Returns:
The value of this element.

getValueAsString

public String getValueAsString()
Returns the value of this element as a String.

Returns:
The value of this element as a String.

getValueAsStringBuffer

public StringBuffer getValueAsStringBuffer()
Returns the value of this element as a StringBuffer.

Returns:
The value of this element as a StringBuffer.

getValueAsCharacter

public Character getValueAsCharacter()
                              throws CharacterFormatException
Returns the value of this element as a Character.

Returns:
The value of this element as a Character.
Throws:
CharacterFormatExeption - When the value couldn't be cast to a character.
CharacterFormatException

getValueAsByte

public Byte getValueAsByte()
                    throws NumberFormatException
Returns the value of this element as a Byte.

Returns:
The value of this element as a Byte.
Throws:
NumberFormatExeption - When the value couldn't be cast to a Byte.
NumberFormatException

getValueAsShort

public Short getValueAsShort()
                      throws NumberFormatException
Returns the value of this element as a Short.

Returns:
The value of this element as a Short.
Throws:
NumberFormatExeption - When the value couldn't be cast to a Short.
NumberFormatException

getValueAsInteger

public Integer getValueAsInteger()
                          throws NumberFormatException
Returns the value of this element as an Integer.

Returns:
The value of this element as a Integer.
Throws:
NumberFormatExeption - When the value couldn't be cast to a Integer.
NumberFormatException

getValueAsLong

public Long getValueAsLong()
                    throws NumberFormatException
Returns the value of this element as an Long.

Returns:
The value of this element as a Long.
Throws:
NumberFormatExeption - When the value couldn't be cast to a Long.
NumberFormatException

getValueAsFloat

public Float getValueAsFloat()
                      throws NumberFormatException
Returns the value of this element as an Float.

Returns:
The value of this element as a Float.
Throws:
NumberFormatExeption - When the value couldn't be cast to a Float.
NumberFormatException

getValueAsDouble

public Double getValueAsDouble()
                        throws NumberFormatException
Returns the value of this element as an Double.

Returns:
The value of this element as a Double.
Throws:
NumberFormatExeption - When the value couldn't be cast to a Double.
NumberFormatException

getValueAsBoolean

public Boolean getValueAsBoolean()
                          throws BooleanFormatException
Returns the value of this element as a Boolean.

Returns:
The value of this element as a Boolean.
Throws:
BooleanFormatException - When the value couldn't be cast to a Boolean.

toString

public String toString(String indent)
Returns a string representation of this SDLDataElement with the given indentation.

Specified by:
toString in class SDLElement
Parameters:
indent - The indentation to be used.
Returns:
A string representation of this SDLDataElement.