Top Description Inners Fields Constructors Methods
com.fasterxml.aalto.out

pack-priv final Class OutputElement

extends Object
Class Inheritance
Imports
java.util.*, javax.xml.XMLConstants, javax.xml.namespace.NamespaceContext, .QName, com.fasterxml.aalto.util.EmptyIterator

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 and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private String
_defaultNsURI

Namespace context end application may have supplied, and that (if given) should be used to augment explicitly defined bindings.

private WName
_name

Prefixed name used for serialization.

private NsBinder
private OutputElement
_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).

private String
_uri

Namespace of the element, whatever prefix part of _name maps to.

pack-priv static final byte
pack-priv static final byte
pack-priv static final byte

Constructor Summary

AccessConstructor and Description
private
private
OutputElement(OutputElement parent, WName name, String uri, NsBinder binder)

Method Summary

Modifier and TypeMethod and Description
public void
addPrefix(String prefix, String uri)

protected void
addToPool(OutputElement poolHead)

Method called to temporarily link this instance to a pool, to allow reusing of instances with the same reader.

public OutputElement.PrefixState

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.
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
public String
generatePrefix(NamespaceContext rootNsContext, String prefixBase, int[] seqArr)

public String
public String
getExplicitPrefix(String uri, NamespaceContext rootNsContext)

Method similar to getPrefix, but one that will not accept the default namespace, only an explicit one.

public String
public WName
public String

Returns:

String presentation of the fully-qualified name, in "prefix:localName" format (no URI). Useful for error and debugging messages.
getNameDesc
()

public String
public String
public String
public String
public OutputElement
public String
public Iterator<String>
getPrefixes(String uri, NamespaceContext rootNsContext)

public QName
public boolean
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean
public boolean
isPrefixBoundTo(String prefix, String nsURI, NamespaceContext rootNsContext)

public boolean
isPrefixUnbound(String prefix, NamespaceContext rootNsContext)

public boolean
protected OutputElement

Returns:

New head of the recycle pool
reuseAsChild
(OutputElement parent, WName name)

protected OutputElement
reuseAsChild(OutputElement parent, WName name, String nsURI)

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

_defaultNsURIback to summary
private String _defaultNsURI

Namespace context end application may have supplied, and that (if given) should be used to augment explicitly defined bindings.

_nameback to summary
private WName _name

Prefixed name used for serialization.

_nsBinderback to summary
private NsBinder _nsBinder
_parentback to summary
private OutputElement _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).

_uriback to summary
private String _uri

Namespace of the element, whatever prefix part of _name maps to. Non-final to allow reuse.

BYTE_GTback to summary
pack-priv static final byte BYTE_GT
BYTE_LTback to summary
pack-priv static final byte BYTE_LT
BYTE_SLASHback to summary
pack-priv static final byte BYTE_SLASH

Constructor Detail

OutputElementback to summary
private OutputElement()
OutputElementback to summary
private OutputElement(OutputElement parent, WName name, String uri, NsBinder binder)

Method Detail

addPrefixback to summary
public void addPrefix(String prefix, String uri)
addToPoolback to summary
protected void addToPool(OutputElement poolHead)

Method called to temporarily link this instance to a pool, to allow reusing of instances with the same reader.

checkPrefixValidityback to summary
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:OutputElement.PrefixState

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.

createChildback to summary
protected OutputElement createChild(WName name)

Simplest factory method, which gets called when non-namespace element output method is called. It is, then, assumed to use the default namespce.

createChildback to summary
protected OutputElement createChild(WName name, String uri)

Full factory method, used for 'normal' namespace qualified output methods.

createRootback to summary
protected static OutputElement createRoot()
generatePrefixback to summary
public String generatePrefix(NamespaceContext rootNsContext, String prefixBase, int[] seqArr)
getDefaultNsURIback to summary
public String getDefaultNsURI()
getExplicitPrefixback to summary
public String getExplicitPrefix(String uri, NamespaceContext rootNsContext)

Method similar to getPrefix, but one that will not accept the default namespace, only an explicit one. Usually used when trying to find a prefix for attributes.

getLocalNameback to summary
public String getLocalName()
getNameback to summary
public WName getName()
getNameDescback to summary
public String getNameDesc()
Returns:String

String presentation of the fully-qualified name, in "prefix:localName" format (no URI). Useful for error and debugging messages.

getNamespaceURIback to summary
public String getNamespaceURI()
getNamespaceURIback to summary
public String getNamespaceURI(String prefix)
getNonNullNamespaceURIback to summary
public String getNonNullNamespaceURI()
getNonNullPrefixback to summary
public String getNonNullPrefix()
getParentback to summary
public OutputElement getParent()
getPrefixback to summary
public String getPrefix(String uri)
getPrefixesback to summary
public Iterator<String> getPrefixes(String uri, NamespaceContext rootNsContext)
Annotations
@SuppressWarnings:unchecked
getQNameback to summary
public QName getQName()
hasEmptyDefaultNsback to summary
public boolean hasEmptyDefaultNs()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
hasPrefixback to summary
public boolean hasPrefix()
isPrefixBoundToback to summary
public boolean isPrefixBoundTo(String prefix, String nsURI, NamespaceContext rootNsContext)
isPrefixUnboundback to summary
public boolean isPrefixUnbound(String prefix, NamespaceContext rootNsContext)
isRootback to summary
public boolean isRoot()
reuseAsChildback to summary
protected OutputElement reuseAsChild(OutputElement parent, WName name)
Returns:OutputElement

New head of the recycle pool

reuseAsChildback to summary
protected OutputElement reuseAsChild(OutputElement parent, WName name, String nsURI)
setDefaultNsURIback to summary
public void setDefaultNsURI(String uri)
com.fasterxml.aalto.out back to summary

public final Enum OutputElement.PrefixState

extends Enum<OutputElement.PrefixState>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final OutputElement.PrefixState
public static final OutputElement.PrefixState
public static final OutputElement.PrefixState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static OutputElement.PrefixState
public static OutputElement.PrefixState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

MISBOUNDback to summary
public static final OutputElement.PrefixState MISBOUND
OKback to summary
public static final OutputElement.PrefixState OK
UNBOUNDback to summary
public static final OutputElement.PrefixState UNBOUND

Constructor Detail

PrefixStateback to summary
private PrefixState()

Method Detail

valueOfback to summary
public static OutputElement.PrefixState valueOf(String name)
valuesback to summary
public static OutputElement.PrefixState[] values()