|
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
com.tangosol.run.xml.SimpleElement
public class SimpleElement
A simple implementation of the XmlElement interface. Protected methods are provided to support inheriting classes.
Nested Class Summary | |
---|---|
class |
SimpleElement.AttributeMap
A Map implementation using a list that can be a read-only map that supports only Strings for keys and XmlValue for values. |
protected class |
SimpleElement.ElementIterator
Provides an Iterator implementation that exposes only those Elements from the Element list that match a certain name. |
protected class |
SimpleElement.ElementList
An implementation of List that only supports XmlElements as the content of the List. |
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 | |
---|---|
SimpleElement()
Construct an empty SimpleElement. |
|
SimpleElement(String sName)
Construct a SimpleElement. |
|
SimpleElement(String sName,
Object oValue)
Construct a SimpleElement. |
Method Summary | |
---|---|
XmlValue |
addAttribute(String sName)
Provides a means to add a new attribute value. |
XmlElement |
addElement(String sName)
Create a new element and add it as a child element to this element. |
protected void |
checkMutable()
Validates that the element is mutable, otherwise throws an UnsupportedOperationException. |
Object |
clone()
Creates and returns a copy of this SimpleElement. |
XmlElement |
ensureElement(String sPath)
Ensure that a child element exists. |
boolean |
equals(Object o)
Compare this XML element and all of its contained information with another XML element for equality. |
XmlElement |
findElement(String sPath)
Find a child element with the specified '/'-delimited path. |
void |
fromXml(XmlElement xml)
Deserialize the object from an XmlElement. |
String |
getAbsolutePath()
Get the '/'-delimited path of the element starting from the root element. |
XmlValue |
getAttribute(String sName)
Get an attribute value. |
Map |
getAttributeMap()
Get the map of all attributes. |
String |
getComment()
Get the text of any comments that are in the XML element. |
XmlElement |
getElement(String sName)
Get a child element. |
List |
getElementList()
Get the list of all child elements. |
Iterator |
getElements(String sName)
Get an iterator of child elements that have a specific name. |
String |
getName()
Get the name of the element. |
XmlElement |
getRoot()
Get the root element. |
XmlValue |
getSafeAttribute(String sName)
Get an attribute value, and return a temporary value if the attribute does not exist. |
XmlElement |
getSafeElement(String sPath)
Return the specified child element using the same path notation as supported by findElement, but return a read-only element if the specified element does not exist. |
int |
hashCode()
Provide a hash value for this XML element and all of its contained information. |
protected XmlValue |
instantiateAttribute()
Instantiate an XmlValue implementation for an attribute value. |
protected Map |
instantiateAttributeMap()
Instantiate a Map implementation that will support the name to value map used to hold attributes. |
protected XmlElement |
instantiateElement(String sName,
Object oValue)
Instantiate an XmlElement implementation for an element. |
protected List |
instantiateElementList()
Instantiate a List implementation that will hold child elements. |
protected boolean |
isNameMutable()
Determine if the name can be changed. |
void |
readExternal(DataInput in)
Restore the contents of this object by loading the object's state from the passed DataInput object. |
void |
setAttribute(String sName,
XmlValue val)
Set an attribute value. |
void |
setComment(String sComment)
Set the text of this element's comment. |
void |
setName(String sName)
Set the Name of the element. |
String |
toString()
Format the XML element and all its contained information into a String in a display format. |
String |
toString(boolean fPretty)
Format the XML element and all its contained information into a String in a display format. |
XmlElement |
toXml()
Serialize the object into an XmlElement. |
protected void |
writeAttributes(PrintWriter out,
boolean fPretty)
Write the attributes as part of a start tag. |
protected void |
writeChildren(PrintWriter out,
boolean fPretty)
Write the element as it will appear in XML. |
protected void |
writeComment(PrintWriter out,
boolean fPretty)
Write the element as it will appear in XML. |
protected void |
writeEmptyTag(PrintWriter out,
boolean fPretty)
Write the element as a combined start/end tag. |
protected void |
writeEndTag(PrintWriter out,
boolean fPretty)
Write the element's end tag. |
void |
writeExternal(DataOutput out)
Save the contents of this object by storing the object's state into the passed DataOutput object. |
protected void |
writeStartTag(PrintWriter out,
boolean fPretty)
Write the element's start tag. |
void |
writeValue(PrintWriter out,
boolean fPretty)
Write the value as it will appear in XML. |
void |
writeXml(PrintWriter out,
boolean fPretty)
Write the element as it will appear in XML. |
Methods inherited from class com.tangosol.run.xml.SimpleValue |
---|
convert, ensureType, getBinary, getBinary, getBoolean, getBoolean, getDate, getDate, getDateTime, getDateTime, getDecimal, getDecimal, getDouble, getDouble, getInt, getInt, getInternalValue, getLong, getLong, getParent, getString, getString, getTime, getTime, getValue, isAttribute, isContent, isEmpty, isMutable, setAttribute, setBinary, setBoolean, setDate, setDateTime, setDecimal, setDouble, setInt, setInternalValue, setLong, setMutable, setParent, setString, setTime |
Methods inherited from class com.tangosol.util.BitHelper |
---|
countBits, countBits, countBits, indexOfLSB, indexOfLSB, indexOfLSB, indexOfMSB, indexOfMSB, indexOfMSB, toBitString, toBitString, toBitString |
Methods inherited from interface com.tangosol.run.xml.XmlValue |
---|
getBinary, getBinary, getBoolean, getBoolean, getDate, getDate, getDateTime, getDateTime, getDecimal, getDecimal, getDouble, getDouble, getInt, getInt, getLong, getLong, getParent, getString, getString, getTime, getTime, getValue, isAttribute, isContent, isEmpty, isMutable, setBinary, setBoolean, setDate, setDateTime, setDecimal, setDouble, setInt, setLong, setParent, setString, setTime |
Constructor Detail |
---|
public SimpleElement()
public SimpleElement(String sName)
sName
- the name of the elementpublic SimpleElement(String sName, Object oValue)
sName
- the name of the elementoValue
- an initial value for this elementMethod Detail |
---|
public String getName()
getName
in interface XmlElement
public void setName(String sName)
setName
in interface XmlElement
sName
- the new element name
IllegalArgumentException
- if the name is null or if the name is
not a legal XML tag name
UnsupportedOperationException
- if the element cannot be renamedpublic XmlElement getRoot()
getRoot
in interface XmlElement
public String getAbsolutePath()
getAbsolutePath
in interface XmlElement
public List getElementList()
getElementList
in interface XmlElement
public XmlElement getElement(String sName)
getElement
in interface XmlElement
public Iterator getElements(String sName)
getElements
in interface XmlElement
public XmlElement addElement(String sName)
addElement
in interface XmlElement
sName
- the name for the new element
IllegalArgumentException
- if the name is null or if the name is
not a legal XML tag name
UnsupportedOperationException
- if this element is immutable or
otherwise cannot add a child elementpublic XmlElement findElement(String sPath)
findElement
in interface XmlElement
sPath
- element path
public XmlElement getSafeElement(String sPath)
getSafeElement
in interface XmlElement
sPath
- element path
public XmlElement ensureElement(String sPath)
ensureElement
in interface XmlElement
sPath
- element path
IllegalArgumentException
- if the name is null or if any part
of the path is not a legal XML tag name
UnsupportedOperationException
- if any element in the path
is immutable or otherwise cannot add a child elementfindElement(java.lang.String)
public Map getAttributeMap()
getAttributeMap
in interface XmlElement
public XmlValue getAttribute(String sName)
getAttribute
in interface XmlElement
sName
- the name of the attribute
public void setAttribute(String sName, XmlValue val)
setAttribute
in interface XmlElement
sName
- the name of the attributeval
- the new value for the attribute; null indicates that the
attribute should be removedpublic XmlValue addAttribute(String sName)
addAttribute
in interface XmlElement
sName
- the name of the attributepublic XmlValue getSafeAttribute(String sName)
getSafeAttribute
in interface XmlElement
sName
- the name of the attribute
public String getComment()
getComment
in interface XmlElement
public void setComment(String sComment)
setComment
in interface XmlElement
sComment
- the comment text
IllegalArgumentException
- if the comment contains "--"public void writeXml(PrintWriter out, boolean fPretty)
writeXml
in interface XmlElement
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 writeValue(PrintWriter out, boolean fPretty)
writeValue
in interface XmlValue
writeValue
in class SimpleValue
out
- a PrintWriter object to use to write tofPretty
- true to specify that the output is intended to be as
human readable as possiblepublic XmlElement toXml()
toXml
in interface XmlSerializable
public void fromXml(XmlElement xml)
fromXml
in interface XmlSerializable
xml
- an XmlElement that contains the serialized form of the
object
UnsupportedOperationException
- if this element is immutablepublic void readExternal(DataInput in) throws IOException
readExternal
in interface ExternalizableLite
readExternal
in class SimpleValue
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
writeExternal
in class SimpleValue
out
- the DataOutput stream to write the state of this object to
IOException
- if an I/O exception occursprotected void checkMutable()
UnsupportedOperationException
protected boolean isNameMutable()
protected List instantiateElementList()
protected XmlElement instantiateElement(String sName, Object oValue)
sName
- element nameoValue
- element value
protected Map instantiateAttributeMap()
protected XmlValue instantiateAttribute()
protected void writeEmptyTag(PrintWriter out, boolean fPretty)
out
- a PrintWriter object to use to write tofPretty
- true to specify that the output is intended to be as
human readable as possibleprotected void writeStartTag(PrintWriter out, boolean fPretty)
out
- a PrintWriter object to use to write tofPretty
- true to specify that the output is intended to be as
human readable as possibleprotected void writeEndTag(PrintWriter out, boolean fPretty)
out
- a PrintWriter object to use to write tofPretty
- true to specify that the output is intended to be as
human readable as possibleprotected void writeAttributes(PrintWriter out, boolean fPretty)
out
- a PrintWriter object to use to write tofPretty
- true to specify that the output is intended to be as
human readable as possibleprotected void writeComment(PrintWriter out, boolean fPretty)
out
- a PrintWriter object to use to write tofPretty
- true to specify that the output is intended to be as
human readable as possibleprotected void writeChildren(PrintWriter out, boolean fPretty)
out
- a PrintWriter object to use to write tofPretty
- true to specify that the output is intended to be as
human readable as possiblepublic String toString()
toString
in interface XmlElement
toString
in interface XmlValue
toString
in class SimpleValue
public String toString(boolean fPretty)
fPretty
- true to specify that the output is intended to be as
human readable as possible
public int hashCode()
hashCode
in interface XmlElement
hashCode
in interface XmlValue
hashCode
in class SimpleValue
public boolean equals(Object o)
equals
in interface XmlElement
equals
in interface XmlValue
equals
in class SimpleValue
public Object clone()
clone
in interface XmlElement
clone
in interface XmlValue
clone
in class SimpleValue
|
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 |