One noteworthy feature of the class is that it is designed to allow "short-term recycling", ie. instances can be reused within context of a simple document output. While reuse/recycling of such lightweight object is often useless or even counter productive, here it may be worth using, due to simplicity of the scheme (basically using a very simple free-elements linked list).
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | SimpleOutputElement.
Simple key class used to represent two-piece (attribute) names; first part being optional (URI), and second non-optional (local name). |
| Modifier and Type | Field and Description |
|---|---|
| protected HashSet | mAttrSet
Map used to check for duplicate attribute declarations, if feature is enabled. |
| protected String | mLocalName
Local name of the element. |
| protected SimpleOutputElement | mParent
Reference to the parent element, element enclosing this element. |
| protected String | mPrefix
Prefix that is used for the element. |
| protected String |
| Access | Constructor and Description |
|---|---|
| private | |
| private | SimpleOutputElement(SimpleOutputElement parent, String prefix, String localName, String uri, BijectiveNsMap ns)
|
| Modifier and Type | Method and Description |
|---|---|
| protected void | addToPool(SimpleOutputElement poolHead)
Method called to temporarily link this instance to a pool, to allow reusing of instances with the same reader. |
| public void | |
| protected SimpleOutputElement | createChild(String localName)
Simplest factory method, which gets called when a 1-argument element output method is called. |
| protected SimpleOutputElement | createChild(String prefix, String localName, String uri)
Full factory method, used for 'normal' namespace qualified output methods. |
| public static SimpleOutputElement | |
| public String | |
| public QName | |
| public String | Returns: String presentation of the fully-qualified name, in "prefix:localName" format (no URI). Useful for error and debugging messages.Implements abstract com.
|
| public String | |
| public SimpleOutputElement | |
| public String | |
| public boolean | |
| private void | Returns: Chained pooled instance that should now be head of the reuse chainMethod called to reuse a pooled instance. |
| protected SimpleOutputElement | |
| protected SimpleOutputElement | |
| public void | |
| public void | |
| protected final void | setRootNsContext(NamespaceContext ctxt)
Implements abstract com. Note this method can and will only be called before outputting the root element. |
| mAttrSet | back to summary |
|---|---|
| protected HashSet<SimpleOutputElement. Map used to check for duplicate attribute declarations, if feature is enabled. | |
| mLocalName | back to summary |
|---|---|
| protected String mLocalName Local name of the element. Non-final only to allow reuse. | |
| mParent | back to summary |
|---|---|
| protected SimpleOutputElement mParent Reference to the parent element, element enclosing this element. Null for root element. Non-final only to allow temporary pooling (on per-writer basis, to keep these short-lived). | |
| mPrefix | back to summary |
|---|---|
| protected String mPrefix Prefix that is used for the element. Can not be final, since sometimes it needs to be dynamically generated and bound after creating the element instance. | |
| mURI | back to summary |
|---|---|
| protected String mURI Namespace of the element, whatever | |
| SimpleOutputElement | back to summary |
|---|---|
| private SimpleOutputElement() Constructor for the virtual root element | |
| SimpleOutputElement | back to summary |
|---|---|
| private SimpleOutputElement(SimpleOutputElement parent, String prefix, String localName, String uri, BijectiveNsMap ns) | |
| addToPool | back to summary |
|---|---|
| protected void addToPool(SimpleOutputElement poolHead) Method called to temporarily link this instance to a pool, to allow reusing of instances with the same reader. | |
| checkAttrWrite | back to summary |
|---|---|
| public void checkAttrWrite(String nsURI, String localName) throws XMLStreamException | |
| createChild | back to summary |
|---|---|
| protected SimpleOutputElement createChild(String localName) Simplest factory method, which gets called when a 1-argument element output method is called. It is, then, assumed to use the default namespce. | |
| createChild | back to summary |
|---|---|
| protected SimpleOutputElement createChild(String prefix, String localName, String uri) Full factory method, used for 'normal' namespace qualified output methods. | |
| createRoot | back to summary |
|---|---|
| public static SimpleOutputElement createRoot() | |
| getLocalName | back to summary |
|---|---|
| public String getLocalName() | |
| getName | back to summary |
|---|---|
| public QName getName() | |
| getNameDesc | back to summary |
|---|---|
| public String getNameDesc() Implements abstract com. | |
| getNamespaceURI | back to summary |
|---|---|
| public String getNamespaceURI() | |
| getParent | back to summary |
|---|---|
| public SimpleOutputElement getParent() | |
| getPrefix | back to summary |
|---|---|
| public String getPrefix() | |
| isRoot | back to summary |
|---|---|
| public boolean isRoot() Implements abstract com.
| |
| relink | back to summary |
|---|---|
| private void relink(SimpleOutputElement parent, String prefix, String localName, String uri) Method called to reuse a pooled instance.
| |
| reuseAsChild | back to summary |
|---|---|
protected SimpleOutputElement reuseAsChild(SimpleOutputElement parent, String localName)
| |
| reuseAsChild | back to summary |
|---|---|
| protected SimpleOutputElement reuseAsChild(SimpleOutputElement parent, String prefix, String localName, String uri) | |
| setDefaultNsUri | back to summary |
|---|---|
| public void setDefaultNsUri(String uri) Implements abstract com.
| |
| setPrefix | back to summary |
|---|---|
| public void setPrefix(String prefix) | |
| setRootNsContext | back to summary |
|---|---|
| protected final void setRootNsContext(NamespaceContext ctxt) Implements abstract com. Note this method can and will only be called before outputting the root element.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final int | mHashCode
Let's cache the hash code, since although hash calculation is fast, hash code is needed a lot as this is always used as a HashSet/TreeMap key. |
| pack-priv final String | |
| pack-priv final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | compareTo(SimpleOutputElement.
the object to be compared. otherImplements java. Compares this object with the specified object for order. |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | |
| public String |
| mHashCode | back to summary |
|---|---|
| pack-priv final int mHashCode Let's cache the hash code, since although hash calculation is fast, hash code is needed a lot as this is always used as a HashSet/TreeMap key. | |
| mLocalName | back to summary |
|---|---|
| pack-priv final String mLocalName | |
| mNsURI | back to summary |
|---|---|
| pack-priv final String mNsURI | |
| AttrName | back to summary |
|---|---|
| public AttrName(String nsURI, String localName) | |
| compareTo | back to summary |
|---|---|
| public int compareTo(SimpleOutputElement. Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |