|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.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(java.lang.String sName) Construct a SimpleElement. |
|
SimpleElement(java.lang.String sName, java.lang.Object oValue) Construct a SimpleElement. |
Method Summary | |
---|---|
XmlValue |
addAttribute(java.lang.String sName) Provides a means to add a new attribute value. |
XmlElement |
addElement(java.lang.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. |
java.lang.Object |
clone() Creates and returns a copy of this SimpleElement. |
XmlElement |
ensureElement(java.lang.String sPath) Ensure that a child element exists. |
boolean |
equals(java.lang.Object o) Compare this XML element and all of its contained information with another XML element for equality. |
XmlElement |
findElement(java.lang.String sPath) Find a child element with the specified '/'-delimited path. |
void |
fromXml(XmlElement xml) Deserialize the object from an XmlElement. |
java.lang.String |
getAbsolutePath() Get the '/'-delimited path of the element starting from the root element. |
XmlValue |
getAttribute(java.lang.String sName) Get an attribute value. |
java.util.Map |
getAttributeMap() Get the map of all attributes. |
java.lang.String |
getComment() Get the text of any comments that are in the XML element. |
XmlElement |
getElement(java.lang.String sName) Get a child element. |
java.util.List |
getElementList() Get the list of all child elements. |
java.util.Iterator |
getElements(java.lang.String sName) Get an iterator of child elements that have a specific name. |
java.lang.String |
getName() Get the name of the element. |
QualifiedName |
getQualifiedName() Obtains the QualifiedName of the XmlElement . |
XmlElement |
getRoot() Get the root element. |
XmlValue |
getSafeAttribute(java.lang.String sName) Get an attribute value, and return a temporary value if the attribute does not exist. |
XmlElement |
getSafeElement(java.lang.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 java.util.Map |
instantiateAttributeMap() Instantiate a Map implementation that will support the name to value map used to hold attributes. |
protected XmlElement |
instantiateElement(java.lang.String sName, java.lang.Object oValue) Instantiate an XmlElement implementation for an element. |
protected java.util.List |
instantiateElementList() Instantiate a List implementation that will hold child elements. |
protected boolean |
isNameMutable() Determine if the name can be changed. |
void |
readExternal(java.io.DataInput in) Restore the contents of this object by loading the object's state from the passed DataInput object. |
void |
readExternal(PofReader in) Restore the contents of a user type instance by reading its state using the specified PofReader object. |
void |
setAttribute(java.lang.String sName, XmlValue val) Set an attribute value. |
void |
setComment(java.lang.String sComment) Set the text of this element's comment. |
void |
setName(java.lang.String sName) Set the Name of the element. |
java.lang.String |
toString() Format the XML element and all its contained information into a String in a display format. |
java.lang.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(java.io.PrintWriter out, boolean fPretty) Write the attributes as part of a start tag. |
protected void |
writeChildren(java.io.PrintWriter out, boolean fPretty) Write the element as it will appear in XML. |
protected void |
writeComment(java.io.PrintWriter out, boolean fPretty) Write the element as it will appear in XML. |
protected void |
writeEmptyTag(java.io.PrintWriter out, boolean fPretty) Write the element as a combined start/end tag. |
protected void |
writeEndTag(java.io.PrintWriter out, boolean fPretty) Write the element's end tag. |
void |
writeExternal(java.io.DataOutput out) Save the contents of this object by storing the object's state into the passed DataOutput object. |
void |
writeExternal(PofWriter out) Save the contents of a POF user type instance by writing its state using the specified PofWriter object. |
protected void |
writeStartTag(java.io.PrintWriter out, boolean fPretty) Write the element's start tag. |
void |
writeValue(java.io.PrintWriter out, boolean fPretty) Write the value as it will appear in XML. |
void |
writeXml(java.io.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, rotateLeft, rotateLeft, rotateLeft, rotateRight, rotateRight, rotateRight, 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(java.lang.String sName)
sName
- the name of the elementpublic SimpleElement(java.lang.String sName, java.lang.Object oValue)
sName
- the name of the elementoValue
- an initial value for this elementMethod Detail |
---|
public java.lang.String getName()
getName
in interface XmlElement
public void setName(java.lang.String sName)
setName
in interface XmlElement
sName
- the new element namejava.lang.IllegalArgumentException
- if the name is null or if the name is not a legal XML tag namejava.lang.UnsupportedOperationException
- if the element cannot be renamedpublic QualifiedName getQualifiedName()
QualifiedName
of the XmlElement
.getQualifiedName
in interface XmlElement
QualifiedName
public XmlElement getRoot()
getRoot
in interface XmlElement
public java.lang.String getAbsolutePath()
getAbsolutePath
in interface XmlElement
public java.util.List getElementList()
getElementList
in interface XmlElement
public XmlElement getElement(java.lang.String sName)
getElement
in interface XmlElement
public java.util.Iterator getElements(java.lang.String sName)
getElements
in interface XmlElement
public XmlElement addElement(java.lang.String sName)
addElement
in interface XmlElement
sName
- the name for the new elementjava.lang.IllegalArgumentException
- if the name is null or if the name is not a legal XML tag namejava.lang.UnsupportedOperationException
- if this element is immutable or otherwise cannot add a child elementpublic XmlElement findElement(java.lang.String sPath)
findElement
in interface XmlElement
sPath
- element pathpublic XmlElement getSafeElement(java.lang.String sPath)
getSafeElement
in interface XmlElement
sPath
- element pathpublic XmlElement ensureElement(java.lang.String sPath)
ensureElement
in interface XmlElement
sPath
- element pathjava.lang.IllegalArgumentException
- if the name is null or if any part of the path is not a legal XML tag namejava.lang.UnsupportedOperationException
- if any element in the path is immutable or otherwise cannot add a child elementfindElement(java.lang.String)
public java.util.Map getAttributeMap()
getAttributeMap
in interface XmlElement
public XmlValue getAttribute(java.lang.String sName)
getAttribute
in interface XmlElement
sName
- the name of the attributepublic void setAttribute(java.lang.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(java.lang.String sName)
addAttribute
in interface XmlElement
sName
- the name of the attributepublic XmlValue getSafeAttribute(java.lang.String sName)
getSafeAttribute
in interface XmlElement
sName
- the name of the attributepublic java.lang.String getComment()
getComment
in interface XmlElement
public void setComment(java.lang.String sComment)
setComment
in interface XmlElement
sComment
- the comment textjava.lang.IllegalArgumentException
- if the comment contains "--"public void writeXml(java.io.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(java.io.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 objectjava.lang.UnsupportedOperationException
- if this element is immutablepublic void readExternal(java.io.DataInput in) throws java.io.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 objectjava.io.IOException
- if an I/O exception occursjava.io.NotActiveException
- if the object is not in its initial state, and therefore cannot be deserialized intopublic void writeExternal(java.io.DataOutput out) throws java.io.IOException
writeExternal
in interface ExternalizableLite
writeExternal
in class SimpleValue
out
- the DataOutput stream to write the state of this object tojava.io.IOException
- if an I/O exception occurspublic void readExternal(PofReader in) throws java.io.IOException
readExternal
in interface PortableObject
readExternal
in class SimpleValue
in
- the PofReader from which to read the object's statejava.io.IOException
- if an I/O error occurspublic void writeExternal(PofWriter out) throws java.io.IOException
writeExternal
in interface PortableObject
writeExternal
in class SimpleValue
out
- the PofWriter to which to write the object's statejava.io.IOException
- if an I/O error occursprotected void checkMutable()
java.lang.UnsupportedOperationException
protected boolean isNameMutable()
protected java.util.List instantiateElementList()
protected XmlElement instantiateElement(java.lang.String sName, java.lang.Object oValue)
sName
- element nameoValue
- element valueprotected java.util.Map instantiateAttributeMap()
protected XmlValue instantiateAttribute()
protected void writeEmptyTag(java.io.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(java.io.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(java.io.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(java.io.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(java.io.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(java.io.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 java.lang.String toString()
toString
in interface XmlElement
toString
in interface XmlValue
toString
in class SimpleValue
public java.lang.String toString(boolean fPretty)
fPretty
- true to specify that the output is intended to be as human readable as possiblepublic int hashCode()
hashCode
in interface XmlElement
hashCode
in interface XmlValue
hashCode
in class SimpleValue
public boolean equals(java.lang.Object o)
equals
in interface XmlElement
equals
in interface XmlValue
equals
in class SimpleValue
public java.lang.Object clone()
clone
in interface XmlElement
clone
in interface XmlValue
clone
in class SimpleValue
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |