Class SaajStaxWriter.DeferredElement
- java.lang.Object
-
- com.sun.xml.messaging.saaj.util.stax.SaajStaxWriter.DeferredElement
-
- Enclosing class:
- SaajStaxWriter
public static class SaajStaxWriter.DeferredElement extends Object
Holds details of element that needs to be deferred in order to manage namespace assignments correctly.An instance of can be set with all the aspects of the element name (local name, prefix, namespace uri). Attributes and namespace declarations (special case of attribute) can be added. Namespace declarations are handled so that the element namespace is updated if it is implied by the namespace declaration and the namespace was not set to non-
nullvalue previously.The state of this object can be
flushedto SOAPElement - new SOAPElement will be added a child element; the new element will have exactly the shape as represented by the state of this object. Note that theflushTo(SOAPElement)method does nothing (and returns the argument immediately) if the state of this object is not initialized (i.e. local name is null).- Author:
- ondrej.cerny@oracle.com
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(String prefix, String ns, String ln, String value)Adds attribute to the element.voidaddNamespaceDeclaration(String prefix, String namespaceUri)Adds namespace prefix assignment to the element.jakarta.xml.soap.SOAPElementflushTo(jakarta.xml.soap.SOAPElement target)Flushes state of this element to thetargetelement.booleanisInitialized()Is the element initialized?voidsetLocalName(String localName)Set local name of the element.voidsetNamespaceUri(String namespaceUri)Set namespace uri.voidsetPrefix(String prefix)Set prefix of the element.
-
-
-
Method Detail
-
setPrefix
public void setPrefix(String prefix)
Set prefix of the element.- Parameters:
prefix- namespace prefix
-
setLocalName
public void setLocalName(String localName)
Set local name of the element.This method initializes the element.
- Parameters:
localName- local namenot null
-
setNamespaceUri
public void setNamespaceUri(String namespaceUri)
Set namespace uri.- Parameters:
namespaceUri- namespace uri
-
addNamespaceDeclaration
public void addNamespaceDeclaration(String prefix, String namespaceUri)
Adds namespace prefix assignment to the element.- Parameters:
prefix- prefix (notnull)namespaceUri- namespace uri
-
addAttribute
public void addAttribute(String prefix, String ns, String ln, String value)
Adds attribute to the element.- Parameters:
prefix- prefixns- namespaceln- local namevalue- value
-
flushTo
public jakarta.xml.soap.SOAPElement flushTo(jakarta.xml.soap.SOAPElement target) throws XMLStreamExceptionFlushes state of this element to thetargetelement.If this element is initialized then it is added with all the namespace declarations and attributes to the
targetelement as a child. The state of this element is reset to uninitialized. The newly added element object is returned.If this element is not initialized then the
targetis returned immediately, nothing else is done.- Parameters:
target- target element- Returns:
targetor new element- Throws:
XMLStreamException- on error
-
isInitialized
public boolean isInitialized()
Is the element initialized?- Returns:
- boolean indicating whether it was initialized after last flush
-
-