|
Nux 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nux.xom.binary.NodeBuilder
public final class NodeBuilder
EXPERIMENTAL; Not part of published API; Subject to change or removal without notice. Wishing Java had "friends" to make select internal classes visible across package boundaries...
Small fast utility for efficient construction of elements and attributes. Implemented via a LRU cache of the most recent elements and attributes.
Avoids repeated XML reverification in XOM Element and Attribute constructor on cache hit, plus avoids generating new String objects by quasi "interning" localName and prefix, which in turn reduces memory consumption. Has overhead close to zero on cache miss.
This implementation is not thread-safe.
This class would become obsolete if the XOM Element and Attribute classes would have an internal LRU cache of QNames.
Constructor Summary | |
---|---|
NodeBuilder()
Constructs a new instance. |
Method Summary | |
---|---|
Attribute |
createAttribute(String qname,
String uri,
String value,
Attribute.Type type)
Contructs and returns a new attribute for the given qualified name and namespace URI. |
Element |
createElement(String qname,
String uri)
Contructs and returns a new element for the given qualified name and namespace URI. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NodeBuilder()
Method Detail |
---|
public Element createElement(String qname, String uri)
qname
- the qualified name of the element (must not be null)uri
- the namespace URI of the element
public Attribute createAttribute(String qname, String uri, String value, Attribute.Type type)
qname
- the qualified name of the attribute (must not be null)uri
- the namespace URI of the attributevalue
- the attribute value (must not be null)type
- the attribute type (must not be null)
|
Nux 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |