|
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 element
public SimpleElement(String sName,
Object oValue)
sName - the name of the elementoValue - an initial value for this element| Method Detail |
|---|
public String getName()
getName in interface XmlElementpublic void setName(String sName)
setName in interface XmlElementsName - 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 XmlElementpublic String getAbsolutePath()
getAbsolutePath in interface XmlElementpublic List getElementList()
getElementList in interface XmlElementpublic XmlElement getElement(String sName)
getElement in interface XmlElementpublic Iterator getElements(String sName)
getElements in interface XmlElementpublic XmlElement addElement(String sName)
addElement in interface XmlElementsName - 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 XmlElementsPath - element path
public XmlElement getSafeElement(String sPath)
getSafeElement in interface XmlElementsPath - element path
public XmlElement ensureElement(String sPath)
ensureElement in interface XmlElementsPath - 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 XmlElementpublic XmlValue getAttribute(String sName)
getAttribute in interface XmlElementsName - the name of the attribute
public void setAttribute(String sName,
XmlValue val)
setAttribute in interface XmlElementsName - 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 XmlElementsName - the name of the attributepublic XmlValue getSafeAttribute(String sName)
getSafeAttribute in interface XmlElementsName - the name of the attribute
public String getComment()
getComment in interface XmlElementpublic void setComment(String sComment)
setComment in interface XmlElementsComment - the comment text
IllegalArgumentException - if the comment contains "--"
public void writeXml(PrintWriter out,
boolean fPretty)
writeXml in interface XmlElementout - a PrintWriter object to use to write tofPretty - true to specify that the output is intended to be as
human readable as possible
public void writeValue(PrintWriter out,
boolean fPretty)
writeValue in interface XmlValuewriteValue in class SimpleValueout - 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 XmlSerializablepublic void fromXml(XmlElement xml)
fromXml in interface XmlSerializablexml - an XmlElement that contains the serialized form of the
object
UnsupportedOperationException - if this element is immutable
public void readExternal(DataInput in)
throws IOException
readExternal in interface ExternalizableLitereadExternal in class SimpleValuein - 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 into
public void writeExternal(DataOutput out)
throws IOException
writeExternal in interface ExternalizableLitewriteExternal in class SimpleValueout - the DataOutput stream to write the state of this object to
IOException - if an I/O exception occursprotected void checkMutable()
UnsupportedOperationExceptionprotected 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 possible
protected 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 possible
protected 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 possible
protected 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 possible
protected 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 possible
protected 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 XmlElementtoString in interface XmlValuetoString in class SimpleValuepublic 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 XmlElementhashCode in interface XmlValuehashCode in class SimpleValuepublic boolean equals(Object o)
equals in interface XmlElementequals in interface XmlValueequals in class SimpleValuepublic Object clone()
clone in interface XmlElementclone in interface XmlValueclone 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 | |||||||