|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tangosol.util.Base
com.tangosol.util.BitHelper
com.tangosol.util.ExternalizableHelper
com.tangosol.run.xml.SimpleValue
public class SimpleValue
A simple implementation of the XmlValue interface. Protected methods are provided to support inheriting classes.
Field Summary |
---|
Fields inherited from interface com.tangosol.run.xml.XmlValue |
---|
TYPE_BINARY, TYPE_BOOLEAN, TYPE_DATE, TYPE_DATETIME, TYPE_DECIMAL, TYPE_DOUBLE, TYPE_INT, TYPE_LONG, TYPE_STRING, TYPE_TIME |
Constructor Summary | |
---|---|
SimpleValue()
Construct an empty SimpleValue. |
|
SimpleValue(Object oValue)
Construct a SimpleValue. |
|
SimpleValue(Object oValue,
boolean fAttribute)
Construct a SimpleValue. |
|
SimpleValue(Object oValue,
boolean fAttribute,
boolean fReadOnly)
Construct a SimpleValue. |
Method Summary | |
---|---|
Object |
clone()
Creates and returns a copy of this SimpleValue. |
protected Object |
convert(Object o,
int nType)
Convert the passed Object to the specified type. |
protected Object |
ensureType(int nType)
Change the type of the internal representation of the XmlValue. |
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. |
protected Object |
getInternalValue()
Get the internal value of this XmlValue. |
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 element. |
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 |
readExternal(DataInput in)
Restore the contents of this object by loading the object's state from the passed DataInput object. |
protected void |
setAttribute(boolean fAttribute)
Specify that this value is an element attribute. |
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. |
protected void |
setInternalValue(Object oValue)
Update the internal representation of the XmlValue. |
void |
setLong(long lVal)
Set the long value. |
protected void |
setMutable(boolean fMutable)
Specify whether this value can be modified or not. |
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 |
writeExternal(DataOutput out)
Save the contents of this object by storing the object's state into the passed DataOutput object. |
void |
writeValue(PrintWriter out,
boolean fPretty)
Write the value as it will appear in XML. |
Methods inherited from class com.tangosol.util.BitHelper |
---|
countBits, countBits, countBits, indexOfLSB, indexOfLSB, indexOfLSB, indexOfMSB, indexOfMSB, indexOfMSB, toBitString, toBitString, toBitString |
Constructor Detail |
---|
public SimpleValue()
public SimpleValue(Object oValue)
oValue
- the initial value for this SimpleValue
IllegalArgumentException
- if the String value is illegalpublic SimpleValue(Object oValue, boolean fAttribute)
oValue
- the initial value for this SimpleValuefAttribute
- true if this SimpleValue is an element attribute
value; false if an element's content's value
IllegalArgumentException
- if the String value is illegalpublic SimpleValue(Object oValue, boolean fAttribute, boolean fReadOnly)
oValue
- the initial value for this SimpleValuefAttribute
- true if this SimpleValue is an element attribute
value; false if an element's content's valuefReadOnly
- true if this SimpleValue is intended to be read-
only once the constructor has finished
IllegalArgumentException
- if the String value is illegalMethod Detail |
---|
public boolean getBoolean()
getBoolean
in interface XmlValue
public boolean getBoolean(boolean fDefault)
getBoolean
in interface XmlValue
fDefault
- the default return value if the internal value can
not be translated into a legal value of type boolean
public void setBoolean(boolean fVal)
setBoolean
in interface XmlValue
fVal
- a new value of type booleanpublic int getInt()
getInt
in interface XmlValue
public int getInt(int nDefault)
getInt
in interface XmlValue
nDefault
- the default return value if the internal value can
not be translated into a legal value of type int
public void setInt(int nVal)
setInt
in interface XmlValue
nVal
- a new value of type intpublic long getLong()
getLong
in interface XmlValue
public long getLong(long lDefault)
getLong
in interface XmlValue
lDefault
- the default return value if the internal value can
not be translated into a legal value of type long
public void setLong(long lVal)
setLong
in interface XmlValue
lVal
- a new value of type longpublic double getDouble()
getDouble
in interface XmlValue
public double getDouble(double dflDefault)
getDouble
in interface XmlValue
dflDefault
- the default return value if the internal value can
not be translated into a legal value of type double
public void setDouble(double dflVal)
setDouble
in interface XmlValue
dflVal
- a new value of type doublepublic BigDecimal getDecimal()
getDecimal
in interface XmlValue
public BigDecimal getDecimal(BigDecimal decDefault)
getDecimal
in interface XmlValue
decDefault
- the default return value if the internal value can
not be translated into a legal value of type decimal
public void setDecimal(BigDecimal decVal)
setDecimal
in interface XmlValue
decVal
- a new value of type BigDecimalpublic String getString()
getString
in interface XmlValue
public String getString(String sDefault)
getString
in interface XmlValue
sDefault
- the default return value if the internal value can
not be translated into a legal value of type String
public void setString(String sVal)
setString
in interface XmlValue
sVal
- a new value of type String
IllegalArgumentException
- if the String value is nullpublic Binary getBinary()
getBinary
in interface XmlValue
public Binary getBinary(Binary binDefault)
getBinary
in interface XmlValue
binDefault
- the default return value if the internal value can
not be translated into a legal value of type Binary
public void setBinary(Binary binVal)
setBinary
in interface XmlValue
binVal
- a new value of type Binary
IllegalArgumentException
- if the binary value is nullpublic Date getDate()
getDate
in interface XmlValue
public Date getDate(Date dtDefault)
getDate
in interface XmlValue
dtDefault
- the default return value if the internal value can
not be translated into a legal value of type Date
public void setDate(Date dtVal)
setDate
in interface XmlValue
dtVal
- a new value of type Datepublic Time getTime()
getTime
in interface XmlValue
public Time getTime(Time dtDefault)
getTime
in interface XmlValue
dtDefault
- the default return value if the internal value can
not be translated into a legal value of type Time
public void setTime(Time dtVal)
setTime
in interface XmlValue
dtVal
- a new value of type Timepublic Timestamp getDateTime()
getDateTime
in interface XmlValue
public Timestamp getDateTime(Timestamp dtDefault)
getDateTime
in interface XmlValue
dtDefault
- the default return value if the internal value can
not be translated into a legal value of type Timestamp
public void setDateTime(Timestamp dtVal)
setDateTime
in interface XmlValue
dtVal
- a new value of type Timestamppublic Object getValue()
getValue
in interface XmlValue
public XmlElement getParent()
getParent
in interface XmlValue
public void setParent(XmlElement element)
setParent
in interface XmlValue
element
- the parent element
IllegalArgumentException
- thrown if the specified parent is null
IllegalStateException
- throw if the parent is already setpublic boolean isEmpty()
isEmpty
in interface XmlValue
public boolean isAttribute()
isAttribute
in interface XmlValue
public boolean isContent()
isContent
in interface XmlValue
public boolean isMutable()
isMutable
in interface XmlValue
public void writeValue(PrintWriter out, boolean fPretty)
writeValue
in interface XmlValue
out
- a PrintWriter object to use to write tofPretty
- true to specify that the output is intended to be as
human readable as possiblepublic void readExternal(DataInput in) throws IOException
readExternal
in interface ExternalizableLite
in
- the DataInput stream to read data from in order to restore
the state of this object
IOException
- if an I/O exception occurs
NotActiveException
- if the object is not in its initial
state, and therefore cannot be deserialized intopublic void writeExternal(DataOutput out) throws IOException
writeExternal
in interface ExternalizableLite
out
- the DataOutput stream to write the state of this object to
IOException
- if an I/O exception occursprotected Object getInternalValue()
protected void setInternalValue(Object oValue)
oValue
- the new value for this SimpleValue object
UnsupportedOperationException
- if this XmlValue is not mutableprotected Object ensureType(int nType)
nType
- the enumerated type to convert to
protected Object convert(Object o, int nType)
o
- the object valuenType
- the enumerated type to convert to
protected void setAttribute(boolean fAttribute)
fAttribute
- true if this value is an element attribute, false if
this value is an element's contentprotected void setMutable(boolean fMutable)
fMutable
- pass true to allow this value to be modified,
otherwise false to indicate that this value is
read-onlypublic String toString()
toString
in interface XmlValue
public int hashCode()
hashCode
in interface XmlValue
public boolean equals(Object o)
equals
in interface XmlValue
public Object clone()
clone
in interface XmlValue
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |