Package com.tangosol.run.xml
Interface XmlValue
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
XmlDocument
,XmlElement
- All Known Implementing Classes:
SimpleDocument
,SimpleElement
,SimpleValue
An interface for XML element content and element attribute values.
- Author:
- cp 2000.10.18
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates and returns a copy of this SimpleValue.boolean
Compare this XML value with another XML value for equality.Get the value as binary.Get the value as binary.boolean
Get the value as a boolean.boolean
getBoolean
(boolean fDefault) Get the value as a boolean.getDate()
Get the value as a Date.Get the value as a Date.Get the value as a Timestamp.getDateTime
(Timestamp dtDefault) Get the value as a Timestamp.Get the value as a decimal.getDecimal
(BigDecimal decDefault) Get the value as a decimal.double
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.Get the parent element of this value.Get the value as a String.Get the value as a String.getTime()
Get the value as a Time.Get the value as a Time.getValue()
Get the value as an Object.int
hashCode()
Provide a hash value for this XML value.boolean
Determine if this value is an element attribute.boolean
Determine if this value is an element's content.boolean
isEmpty()
Determine if the value is empty.boolean
Determine if this value can be modified.void
Set the binary value.void
setBoolean
(boolean fVal) Set the boolean value.void
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
Set the String value.void
Set the Time value.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 Details
-
TYPE_BOOLEAN
static final int TYPE_BOOLEAN- See Also:
-
TYPE_INT
static final int TYPE_INT- See Also:
-
TYPE_LONG
static final int TYPE_LONG- See Also:
-
TYPE_DOUBLE
static final int TYPE_DOUBLE- See Also:
-
TYPE_DECIMAL
static final int TYPE_DECIMAL- See Also:
-
TYPE_STRING
static final int TYPE_STRING- See Also:
-
TYPE_BINARY
static final int TYPE_BINARY- See Also:
-
TYPE_DATE
static final int TYPE_DATE- See Also:
-
TYPE_TIME
static final int TYPE_TIME- See Also:
-
TYPE_DATETIME
static final int TYPE_DATETIME- See Also:
-
-
Method Details
-
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
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
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
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
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
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
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
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
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
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
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
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
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
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 nullIllegalStateException
- 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
Write the value as it will appear in XML.- Parameters:
out
- a PrintWriter object to use to write tofPretty
- 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. -
hashCode
int hashCode()Provide a hash value for this XML value. The hash value is defined as one of the following:- 0 if getValue() returns null
- otherwise the hash value is the hashCode() of the string representation of the value
-
equals
Compare this XML value with another XML value for equality. -
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.
-