Package com.fasterxml.aalto.out
Class OutputElement
java.lang.Object
com.fasterxml.aalto.out.OutputElement
Simple container for information regarding an open element within
stream writer output.
Note: these elements are designed to be reused within context of a single document output, ie. they are owned by the stream writer, and can be recycled by it, as necessary.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
Namespace context end application may have supplied, and that (if given) should be used to augment explicitly defined bindings.private WName
Prefixed name used for serialization.private NsBinder
private OutputElement
Reference to either the parent (enclosing element) of this element, when part of active output context; or link to next reusable unused element after this one (if not part of active context).private String
Namespace of the element, whatever prefix part of_name
maps to.(package private) static final byte
(package private) static final byte
(package private) static final byte
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
private
OutputElement
(OutputElement parent, WName name, String uri, NsBinder binder) -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
addToPool
(OutputElement poolHead) Method called to temporarily link this instance to a pool, to allow reusing of instances with the same reader.checkPrefixValidity
(String prefix, String nsURI, NamespaceContext rootNsContext) Method that verifies that passed-in non-empty prefix indeed maps to specified non-empty namespace URI; and depending on how it goes returns a status for caller.protected OutputElement
createChild
(WName name) Simplest factory method, which gets called when non-namespace element output method is called.protected OutputElement
createChild
(WName name, String uri) Full factory method, used for 'normal' namespace qualified output methods.protected static OutputElement
generatePrefix
(NamespaceContext rootNsContext, String prefixBase, int[] seqArr) getExplicitPrefix
(String uri, NamespaceContext rootNsContext) Method similar togetPrefix(java.lang.String)
, but one that will not accept the default namespace, only an explicit one.getName()
getNamespaceURI
(String prefix) getPrefixes
(String uri, NamespaceContext rootNsContext) getQName()
boolean
int
hashCode()
boolean
boolean
isPrefixBoundTo
(String prefix, String nsURI, NamespaceContext rootNsContext) boolean
isPrefixUnbound
(String prefix, NamespaceContext rootNsContext) boolean
isRoot()
void
relink
(OutputElement parent) Method called to reuse a recycled instance, as is, with same name.private void
relink
(OutputElement parent, WName name, String uri) Method called to reuse a pooled instance, but with different nameprotected OutputElement
reuseAsChild
(OutputElement parent, WName name) protected OutputElement
reuseAsChild
(OutputElement parent, WName name, String nsURI) void
setDefaultNsURI
(String uri)
-
Field Details
-
BYTE_LT
static final byte BYTE_LT- See Also:
-
BYTE_GT
static final byte BYTE_GT- See Also:
-
BYTE_SLASH
static final byte BYTE_SLASH- See Also:
-
_parent
Reference to either the parent (enclosing element) of this element, when part of active output context; or link to next reusable unused element after this one (if not part of active context). -
_name
Prefixed name used for serialization. -
_uri
Namespace of the element, whatever prefix part of_name
maps to. Non-final to allow reuse. -
_defaultNsURI
Namespace context end application may have supplied, and that (if given) should be used to augment explicitly defined bindings. -
_nsBinder
-
-
Constructor Details
-
OutputElement
private OutputElement() -
OutputElement
-
-
Method Details
-
createRoot
-
createChild
Simplest factory method, which gets called when non-namespace element output method is called. It is, then, assumed to use the default namespce. -
createChild
Full factory method, used for 'normal' namespace qualified output methods. -
reuseAsChild
- Returns:
- New head of the recycle pool
-
reuseAsChild
-
relink
Method called to reuse a recycled instance, as is, with same name. -
relink
Method called to reuse a pooled instance, but with different name -
addToPool
Method called to temporarily link this instance to a pool, to allow reusing of instances with the same reader. -
getParent
-
isRoot
public boolean isRoot() -
getName
-
getLocalName
-
getNonNullPrefix
-
hasPrefix
public boolean hasPrefix() -
getNameDesc
- Returns:
- String presentation of the fully-qualified name, in "prefix:localName" format (no URI). Useful for error and debugging messages.
-
getNamespaceURI
-
getNonNullNamespaceURI
-
getDefaultNsURI
-
hasEmptyDefaultNs
public boolean hasEmptyDefaultNs() -
getQName
-
setDefaultNsURI
-
generatePrefix
-
addPrefix
-
getNamespaceURI
-
getPrefix
-
getPrefixes
-
getExplicitPrefix
Method similar togetPrefix(java.lang.String)
, but one that will not accept the default namespace, only an explicit one. Usually used when trying to find a prefix for attributes. -
checkPrefixValidity
public OutputElement.PrefixState checkPrefixValidity(String prefix, String nsURI, NamespaceContext rootNsContext) Method that verifies that passed-in non-empty prefix indeed maps to specified non-empty namespace URI; and depending on how it goes returns a status for caller.- Returns:
- OK, if passed-in prefix matches matched-in namespace URI in current scope; UNBOUND if it's not bound to anything, and MISBOUND if it's bound to another URI.
-
isPrefixBoundTo
-
isPrefixUnbound
-
hashCode
public int hashCode()
-