CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.run.xml
Interface XmlValue

All Superinterfaces:
Serializable
All Known Subinterfaces:
XmlDocument, XmlElement
All Known Implementing Classes:
SimpleDocument, SimpleElement, SimpleValue

public interface XmlValue
extends Serializable

An interface for XML element content and element attribute values.

Author:
cp 2000.10.18

Field Summary
static int TYPE_BINARY
           
static int TYPE_BOOLEAN
           
static int TYPE_DATE
           
static int TYPE_DATETIME
           
static int TYPE_DECIMAL
           
static int TYPE_DOUBLE
           
static int TYPE_INT
           
static int TYPE_LONG
           
static int TYPE_STRING
           
static int TYPE_TIME
           
 
Method Summary
 Object clone()
          Creates and returns a copy of this SimpleValue.
 boolean equals(Object o)
          Compare this XML value with another XML value for equality.
 Binary getBinary()
          Get the value as binary.
 Binary getBinary(Binary binDefault)
          Get the value as binary.
 boolean getBoolean()
          Get the value as a boolean.
 boolean getBoolean(boolean fDefault)
          Get the value as a boolean.
 Date getDate()
          Get the value as a Date.
 Date getDate(Date dtDefault)
          Get the value as a Date.
 Timestamp getDateTime()
          Get the value as a Timestamp.
 Timestamp getDateTime(Timestamp dtDefault)
          Get the value as a Timestamp.
 BigDecimal getDecimal()
          Get the value as a decimal.
 BigDecimal getDecimal(BigDecimal decDefault)
          Get the value as a decimal.
 double getDouble()
          Get the value as a double.
 double getDouble(double dflDefault)
          Get the value as a double.
 int getInt()
          Get the value as an int.
 int getInt(int nDefault)
          Get the value as an int.
 long getLong()
          Get the value as a long.
 long getLong(long lDefault)
          Get the value as a long.
 XmlElement getParent()
          Get the parent element of this value.
 String getString()
          Get the value as a String.
 String getString(String sDefault)
          Get the value as a String.
 Time getTime()
          Get the value as a Time.
 Time getTime(Time dtDefault)
          Get the value as a Time.
 Object getValue()
          Get the value as an Object.
 int hashCode()
          Provide a hash value for this XML value.
 boolean isAttribute()
          Determine if this value is an element attribute.
 boolean isContent()
          Determine if this value is an element's content.
 boolean isEmpty()
          Determine if the value is empty.
 boolean isMutable()
          Determine if this value can be modified.
 void setBinary(Binary binVal)
          Set the binary value.
 void setBoolean(boolean fVal)
          Set the boolean value.
 void setDate(Date dtVal)
          Set the Date value.
 void setDateTime(Timestamp dtVal)
          Set the Timestamp value.
 void setDecimal(BigDecimal decVal)
          Set the dcimal value.
 void setDouble(double dflVal)
          Set the double value.
 void setInt(int nVal)
          Set the int value.
 void setLong(long lVal)
          Set the long value.
 void setParent(XmlElement element)
          Set the parent element of this value.
 void setString(String sVal)
          Set the String value.
 void setTime(Time dtVal)
          Set the Time value.
 String toString()
          Format the XML value into a String in a display format.
 void writeValue(PrintWriter out, boolean fPretty)
          Write the value as it will appear in XML.
 

Field Detail

TYPE_BOOLEAN

static final int TYPE_BOOLEAN
See Also:
Constant Field Values

TYPE_INT

static final int TYPE_INT
See Also:
Constant Field Values

TYPE_LONG

static final int TYPE_LONG
See Also:
Constant Field Values

TYPE_DOUBLE

static final int TYPE_DOUBLE
See Also:
Constant Field Values

TYPE_DECIMAL

static final int TYPE_DECIMAL
See Also:
Constant Field Values

TYPE_STRING

static final int TYPE_STRING
See Also:
Constant Field Values

TYPE_BINARY

static final int TYPE_BINARY
See Also:
Constant Field Values

TYPE_DATE

static final int TYPE_DATE
See Also:
Constant Field Values

TYPE_TIME

static final int TYPE_TIME
See Also:
Constant Field Values

TYPE_DATETIME

static final int TYPE_DATETIME
See Also:
Constant Field Values
Method Detail

getBoolean

boolean getBoolean()
Get the value as a boolean.

Returns:
the value as a boolean

setBoolean

void setBoolean(boolean fVal)
Set the boolean value.

Parameters:
fVal - a new value of type boolean

getInt

int getInt()
Get the value as an int.

Returns:
the value as an int

setInt

void setInt(int nVal)
Set the int value.

Parameters:
nVal - a new value of type int

getLong

long getLong()
Get the value as a long.

Returns:
the value as a long

setLong

void setLong(long lVal)
Set the long value.

Parameters:
lVal - a new value of type long

getDouble

double getDouble()
Get the value as a double.

Returns:
the value as a double

setDouble

void setDouble(double dflVal)
Set the double value.

Parameters:
dflVal - a new value of type double

getDecimal

BigDecimal getDecimal()
Get the value as a decimal.

Returns:
the value as a BigDecimal

setDecimal

void setDecimal(BigDecimal decVal)
Set the dcimal value.

Parameters:
decVal - a new value of type BigDecimal

getString

String getString()
Get the value as a String.

Returns:
the value as a String

setString

void setString(String sVal)
Set the String value.

Parameters:
sVal - a new value of type String

getBinary

Binary getBinary()
Get the value as binary. The XML format is expected to be Base64.

Returns:
the value as a Binary object

setBinary

void setBinary(Binary binVal)
Set the binary value.

Parameters:
binVal - a new value of type Binary

getDate

Date getDate()
Get the value as a Date.

Returns:
the value as a Date

setDate

void setDate(Date dtVal)
Set the Date value.

Parameters:
dtVal - a new value of type Date

getTime

Time getTime()
Get the value as a Time.

Returns:
the value as a Time

setTime

void setTime(Time dtVal)
Set the Time value.

Parameters:
dtVal - a new value of type Time

getDateTime

Timestamp getDateTime()
Get the value as a Timestamp.

Returns:
the value as a Timestamp

setDateTime

void setDateTime(Timestamp dtVal)
Set the Timestamp value.

Parameters:
dtVal - a new value of type Timestamp

getBoolean

boolean getBoolean(boolean fDefault)
Get the value as a boolean.

Parameters:
fDefault - the default return value if the internal value can not be translated into a legal value of type boolean
Returns:
the value as a boolean

getInt

int getInt(int nDefault)
Get the value as an int.

Parameters:
nDefault - the default return value if the internal value can not be translated into a legal value of type int
Returns:
the value as an int

getLong

long getLong(long lDefault)
Get the value as a long.

Parameters:
lDefault - the default return value if the internal value can not be translated into a legal value of type long
Returns:
the value as a long

getDouble

double getDouble(double dflDefault)
Get the value as a double.

Parameters:
dflDefault - the default return value if the internal value can not be translated into a legal value of type double
Returns:
the value as a double

getDecimal

BigDecimal getDecimal(BigDecimal decDefault)
Get the value as a decimal.

Parameters:
decDefault - the default return value if the internal value can not be translated into a legal value of type decimal
Returns:
the value as a decimal

getString

String getString(String sDefault)
Get the value as a String.

Parameters:
sDefault - the default return value if the internal value can not be translated into a legal value of type String
Returns:
the value as a String

getBinary

Binary getBinary(Binary binDefault)
Get the value as binary. The XML format is expected to be Base64.

Parameters:
binDefault - the default return value if the internal value can not be translated into a legal value of type Binary
Returns:
the value as a Binary object

getDate

Date getDate(Date dtDefault)
Get the value as a Date.

Parameters:
dtDefault - the default return value if the internal value can not be translated into a legal value of type Date
Returns:
the value as a Date

getTime

Time getTime(Time dtDefault)
Get the value as a Time.

Parameters:
dtDefault - the default return value if the internal value can not be translated into a legal value of type Time
Returns:
the value as a Time

getDateTime

Timestamp getDateTime(Timestamp dtDefault)
Get the value as a Timestamp.

Parameters:
dtDefault - the default return value if the internal value can not be translated into a legal value of type Timestamp
Returns:
the value as a Timestamp

getValue

Object getValue()
Get the value as an Object. The following types are supported: Boolean Integer Long Double BigDecimal String Binary Date Time Timestamp It is always legal for an implementation to return the value as a String, for example returning a binary value in a base64 encoding. This method exists to allow one value to copy from another value.

Returns:
the value as an Object or null if the XmlValue does not have a value; attributes never have a null value

getParent

XmlElement getParent()
Get the parent element of this value.

Returns:
the parent element, or null if this value has no parent

setParent

void setParent(XmlElement element)
Set the parent element of this value. The parent can not be modified once set.

Parameters:
element - the parent element
Throws:
IllegalArgumentException - thrown if the specified parent is null
IllegalStateException - throw if the parent is already set

isEmpty

boolean isEmpty()
Determine if the value is empty.

Returns:
true if the value is empty

isAttribute

boolean isAttribute()
Determine if this value is an element attribute.

Returns:
true if this value is an element attribute, otherwise false

isContent

boolean isContent()
Determine if this value is an element's content.

Returns:
true if this value is an element's content, otherwise false

isMutable

boolean isMutable()
Determine if this value can be modified. If the value can not be modified, all mutating methods are required to throw an UnsupportedOperationException.

Returns:
true if this value can be modified, otherwise false to indicate that this value is read-only

writeValue

void writeValue(PrintWriter out,
                boolean fPretty)
Write the value as it will appear in XML.

Parameters:
out - a PrintWriter object to use to write to
fPretty - true to specify that the output is intended to be as human readable as possible

toString

String toString()
Format the XML value into a String in a display format.

Returns:
a String representation of the XML value

hashCode

int hashCode()
Provide a hash value for this XML value. The hash value is defined as one of the following:
  1. 0 if getValue() returns null
  2. otherwise the hash value is the hashCode() of the string representation of the value

Returns:
the hash value for this XML value

equals

boolean equals(Object o)
Compare this XML value with another XML value for equality.

Returns:
true if the values are equal, false otherwise

clone

Object clone()
Creates and returns a copy of this SimpleValue. The returned copy is "unlinked" from the parent and mutable

Returns:
a clone of this instance.

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation