public class SimpleElement extends SimpleValue implements XmlElement, XmlSerializable
Modifier and Type | Class and Description |
---|---|
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.
|
ExternalizableHelper.DecoratedMultiBufferReadBuffer, ExternalizableHelper.DefaultObjectStreamFactory, ExternalizableHelper.FormatAwareCompressor, ExternalizableHelper.IntDecoratedObject, ExternalizableHelper.Shielded, ExternalizableHelper.ShieldedDataOutputStream, ExternalizableHelper.ShieldedInputStream, ExternalizableHelper.ShieldedObjectOutputStream, ExternalizableHelper.ShieldedOutputStream, ExternalizableHelper.SimpleXmlBeanClassCache, ExternalizableHelper.Stats, ExternalizableHelper.XmlBeanClassCache
Base.LoggingWriter, Base.StackFrame
CONVERTER_FROM_BINARY, CONVERTER_STRIP_INTDECO, CONVERTER_TO_BINARY, DECO_APP_1, DECO_APP_2, DECO_APP_3, DECO_CUSTOM, DECO_EXPIRY, DECO_ID_MAX, DECO_ID_MIN, DECO_JCACHE, DECO_JCACHE_SYNTHETIC, DECO_MEMCACHED, DECO_PUSHREP, DECO_QUEUE_METADATA, DECO_RSVD_1, DECO_RSVD_2, DECO_STORE, DECO_TX, DECO_VALUE, DECO_WLS, EMPTY_BINARY_ARRAY, FMT_B_ARRAY, FMT_BIN_DECO, FMT_BIN_EXT_DECO, FMT_BINARY, FMT_BOOLEAN, FMT_BYTE, FMT_DECIMAL, FMT_DOUBLE, FMT_EXT, FMT_FLOAT, FMT_IDO, FMT_INT, FMT_INTEGER, FMT_LONG, FMT_NONE, FMT_NULL, FMT_OBJ_EXT, FMT_OBJ_SER, FMT_OPT, FMT_OPT_DOUBLE, FMT_OPT_INT, FMT_OPT_LONG, FMT_SHORT, FMT_STRING, FMT_UNKNOWN, FMT_XML_BEAN, FMT_XML_SER, FORCE_RESOLVING_STREAMS, MAX_DECO_HEADER_BYTES, PROPERTY_CONFIG, s_streamfactory, TRINT_DOMAIN_SPAN, TRINT_MAX_VALUE, TRINT_MAX_VARIANCE, USE_POF_STREAMS, USE_XMLBEAN_CLASS_CACHE, XMLBEAN_CLASS_CACHE
LOG_ALWAYS, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_MAX, LOG_MIN, LOG_QUIET, LOG_WARN, POWER_0, POWER_G, POWER_K, POWER_M, POWER_T, UNIT_D, UNIT_H, UNIT_M, UNIT_MS, UNIT_NS, UNIT_S, UNIT_US
TYPE_BINARY, TYPE_BOOLEAN, TYPE_DATE, TYPE_DATETIME, TYPE_DECIMAL, TYPE_DOUBLE, TYPE_INT, TYPE_LONG, TYPE_STRING, TYPE_TIME
Constructor and Description |
---|
SimpleElement()
Construct an empty SimpleElement.
|
SimpleElement(String sName)
Construct a SimpleElement.
|
SimpleElement(String sName,
Object oValue)
Construct a SimpleElement.
|
Modifier and Type | Method and Description |
---|---|
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.
|
QualifiedName |
getQualifiedName()
Obtains the
QualifiedName of the XmlElement . |
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 |
readExternal(PofReader in)
Restore the contents of a user type instance by reading its state using
the specified PofReader 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.
|
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(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.
|
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
asBinary, calculatePackedLength, calculatePackedLength, checkObjectInputFilter, convertUTF, decodeExpiry, decorate, decorate, decorate, decorate, decorate, decorateBinary, encodeExpiry, ensureSerializer, extractIntDecoration, fromBinary, fromBinary, fromBinary, fromBinary, fromBinary, fromBinary, fromByteArray, fromByteArray, getClass, getDecoration, getDecoration, getDecorations, getDeltaCompressor, getInputStream, getNewObjectInput, getObjectInput, getObjectOutput, getObjectStreamFactory, getOutputStream, getShieldedOutputStream, getStreamFormat, getUndecorated, getUndecorated, isDecorated, isDecorated, isIntDecorated, isIntDecorated, isResolving, isSerializable, isSerializerCompatible, isVersionCompatible, isVersionCompatible, loadClass, loadResource, main, makeTrint, readBigDecimal, readBigInteger, readBooleanArray, readByteArray, readCollection, readDate, readDoubleArray, readExternalizableLite, readExternalizableLite, readFloatArray, readInt, readInt, readIntArray2d, readLong, readLong, readMap, readMap, readObject, readObject, readSafeUTF, readSafeUTF, readSerializable, readSerializable, readStringArray, readTime, readTimestamp, readTrint, readUnsignedTrint, readUTF, readXmlBean, readXmlSerializable, readXmlSerializable, realize, removeIntDecoration, removeIntDecoration, replace, reportIncompatibleSerializers, setObjectStreamFactory, toBinary, toBinary, toByteArray, toByteArray, toByteArray, toLiteBinary, toLong, undecorate, undecorate, validateBufferSize, writeBigDecimal, writeBigInteger, writeBooleanArray, writeByteArray, writeCollection, writeDate, writeDoubleArray, writeExternalizableLite, writeFloatArray, writeInt, writeInt, writeIntArray2d, writeLong, writeLong, writeMap, writeObject, writeSafeUTF, writeSafeUTF, writeSerializable, writeStringArray, writeTime, writeTimestamp, writeTrint, writeTrint, writeUTF, writeXmlBean, writeXmlSerializable
countBits, countBits, countBits, indexOfLSB, indexOfLSB, indexOfLSB, indexOfMSB, indexOfMSB, indexOfMSB, rotateLeft, rotateLeft, rotateLeft, rotateRight, rotateRight, rotateRight, toBitString, toBitString, toBitString, toBytes, toBytes, toBytes, toBytes, toInt, toInt, toLong
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
finalize, getClass, notify, notifyAll, wait, wait, wait
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
public SimpleElement()
public SimpleElement(String sName)
sName
- the name of the elementpublic String getName()
getName
in interface XmlElement
public void setName(String sName)
setName
in interface XmlElement
sName
- the new element nameIllegalArgumentException
- if the name is null or if the name is
not a legal XML tag nameUnsupportedOperationException
- 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 String getAbsolutePath()
getAbsolutePath
in interface XmlElement
public List getElementList()
getElementList
in interface XmlElement
public XmlElement getElement(String sName)
getElement
in interface XmlElement
sName
- the specified namepublic Iterator getElements(String sName)
getElements
in interface XmlElement
sName
- the specified namepublic XmlElement addElement(String sName)
addElement
in interface XmlElement
sName
- the name for the new elementIllegalArgumentException
- if the name is null or if the name is
not a legal XML tag nameUnsupportedOperationException
- if this element is immutable or
otherwise cannot add a child elementpublic XmlElement findElement(String sPath)
findElement
in interface XmlElement
sPath
- element pathpublic XmlElement getSafeElement(String sPath)
getSafeElement
in interface XmlElement
sPath
- element pathpublic XmlElement ensureElement(String sPath)
ensureElement
in interface XmlElement
sPath
- element pathIllegalArgumentException
- if the name is null or if any part
of the path is not a legal XML tag nameUnsupportedOperationException
- 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 attributepublic 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 attributepublic String getComment()
getComment
in interface XmlElement
public void setComment(String sComment)
setComment
in interface XmlElement
sComment
- the comment textIllegalArgumentException
- 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
objectUnsupportedOperationException
- 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 objectIOException
- if an I/O exception occursNotActiveException
- 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 toIOException
- if an I/O exception occurspublic void readExternal(PofReader in) throws IOException
readExternal
in interface PortableObject
readExternal
in class SimpleValue
in
- the PofReader from which to read the object's stateIOException
- if an I/O error occurspublic void writeExternal(PofWriter out) throws IOException
writeExternal
in interface PortableObject
writeExternal
in class SimpleValue
out
- the PofWriter to which to write the object's stateIOException
- if an I/O error occursprotected void checkMutable()
UnsupportedOperationException
- if the document is immutableprotected boolean isNameMutable()
protected List instantiateElementList()
protected XmlElement instantiateElement(String sName, Object oValue)
sName
- element nameoValue
- element valueprotected 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 possiblepublic 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