bibliothek.util.xml
Class XContainer

java.lang.Object
  extended by bibliothek.util.xml.XContainer
Direct Known Subclasses:
XAttribute, XElement

public class XContainer
extends Object

An element that can have some content. The content can be a String, byte-array or a primitive value type.

Author:
Benjamin Sigg

Constructor Summary
XContainer()
           
 
Method Summary
 XContainer copy()
          Creates an independent copy of this container.
protected  void copy(XContainer original)
          Copies all the settings of original into this container.
 boolean getBoolean()
          Gets the value of this container as boolean.
 byte getByte()
          Gets the value of this container as byte.
 byte[] getByteArray()
          Gets the value of this container as byte-array.
 char getChar()
          Gets the value of this container as character.
 double getDouble()
          Gets the value of this container as double.
 float getFloat()
          Gets the value of this container as float.
 int getInt()
          Gets the value of this container as integer.
 long getLong()
          Gets the value of this container as long.
 short getShort()
          Gets the value of this container as short.
 String getString()
          Gets the value of this container as string.
 String getValue()
          Gets the exact value that is stored in this container.
 void setBoolean(boolean b)
          Sets the value of this container.
 void setByte(byte b)
          Sets the value of this container.
 void setByteArray(byte[] bs)
          Sets the value of this container.
 void setChar(char c)
          Sets the value of this container.
 void setDouble(double d)
          Sets the value of this container.
 void setFloat(float f)
          Sets the value of this container.
 void setInt(int i)
          Sets the value of this container.
 void setLong(long l)
          Sets the value of this container.
 void setShort(short s)
          Sets the value of this container.
 void setString(String s)
          Sets the value of this container.
 void setValue(String value)
          Sets the exact value that is stored in this container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XContainer

public XContainer()
Method Detail

copy

public XContainer copy()
Creates an independent copy of this container.

Returns:
the new copy

copy

protected void copy(XContainer original)
Copies all the settings of original into this container.

Parameters:
original - the container to read

setValue

public void setValue(String value)
Sets the exact value that is stored in this container.

Parameters:
value - the value that will not be encoded by this method

getValue

public String getValue()
Gets the exact value that is stored in this container.

Returns:
the value that is not encoded

setByte

public void setByte(byte b)
Sets the value of this container.

Parameters:
b - the value

setShort

public void setShort(short s)
Sets the value of this container.

Parameters:
s - the value

setInt

public void setInt(int i)
Sets the value of this container.

Parameters:
i - the value

setLong

public void setLong(long l)
Sets the value of this container.

Parameters:
l - the value

setBoolean

public void setBoolean(boolean b)
Sets the value of this container.

Parameters:
b - the value

setChar

public void setChar(char c)
Sets the value of this container.

Parameters:
c - the value

setString

public void setString(String s)
Sets the value of this container.

Parameters:
s - the value

setFloat

public void setFloat(float f)
Sets the value of this container.

Parameters:
f - the value

setDouble

public void setDouble(double d)
Sets the value of this container.

Parameters:
d - the value

setByteArray

public void setByteArray(byte[] bs)
Sets the value of this container.

Parameters:
bs - the value

getByte

public byte getByte()
Gets the value of this container as byte.

Returns:
the value
Throws:
XException - if value is not a byte

getShort

public short getShort()
Gets the value of this container as short.

Returns:
the value
Throws:
XException - if value is not a short

getInt

public int getInt()
Gets the value of this container as integer.

Returns:
the value
Throws:
XException - if value is not an integer

getLong

public long getLong()
Gets the value of this container as long.

Returns:
the value
Throws:
XException - if value is not a long

getFloat

public float getFloat()
Gets the value of this container as float.

Returns:
the value
Throws:
XException - if value is not a float

getDouble

public double getDouble()
Gets the value of this container as double.

Returns:
the value
Throws:
XException - if value is not a double

getChar

public char getChar()
Gets the value of this container as character.

Returns:
the value
Throws:
XException - if value is not a character

getString

public String getString()
Gets the value of this container as string.

Returns:
the value
Throws:
XException - if value is not a string

getBoolean

public boolean getBoolean()
Gets the value of this container as boolean.

Returns:
the value
Throws:
XException - if value is not a boolean

getByteArray

public byte[] getByteArray()
Gets the value of this container as byte-array.

Returns:
the value
Throws:
XException - if value is not a byte-array