Class XMLStreamNormalizedNodeStreamWriter<T>
java.lang.Object
org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter<T>
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,ExtensibleObject<org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter,,org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.Extension> ObjectExtension<org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter,,org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.Extension> org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter,org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.Extension,org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.MetadataExtension
public abstract sealed class XMLStreamNormalizedNodeStreamWriter<T>
extends Object
implements org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter, org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.MetadataExtension
A
NormalizedNodeStreamWriter which translates the events into an XMLStreamWriter, resulting in an
RFC6020 XML encoding. There are 2 versions of this class, one that takes a SchemaContext and encodes values
appropriately according to the YANG schema. The other is schema-less and merely outputs values using toString. The
latter is intended for debugging where doesn't have a SchemaContext available and isn't meant for production use.
Due to backwards compatibility reasons this writer recognizes RFC7952 metadata include keys QNames with empty URI
(as exposed via XmlParserStream.LEGACY_ATTRIBUTE_NAMESPACE) as their QNameModule. These indicate an
unqualified XML attribute and their value can be assumed to be a String. Furthermore, this extends to qualified
attributes, which uses the proper namespace, but will not bind to a proper module revision. This caveat will be
removed in a future version.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.Extension, org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.MetadataExtension, org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.MountPointExtension -
Field Summary
Fields inherited from interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
UNKNOWN_SIZE -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWritercreate(XMLStreamWriter writer, EffectiveModelContext context) Create a new writer with the specified context as its root.static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWritercreate(XMLStreamWriter writer, EffectiveModelContext context, boolean preferPrefixes) Create a new writer with the specified context as its root.static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWritercreate(XMLStreamWriter writer, EffectiveModelContext context, @Nullable SchemaNodeIdentifier.Absolute path) Create a new writer with the specified context and rooted in the specified schema path.static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWritercreate(XMLStreamWriter writer, EffectiveModelContext context, @Nullable SchemaNodeIdentifier.Absolute path, boolean preferPrefixes) Create a new writer with the specified context and rooted in the specified schema path.static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWritercreate(XMLStreamWriter writer, EffectiveModelContext context, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path) Create a new writer with the specified context and rooted in the specifiedYangInstanceIdentifier.static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWritercreate(XMLStreamWriter writer, EffectiveModelContext context, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path, boolean preferPrefixes) Create a new writer with the specified context and rooted in the specifiedYangInstanceIdentifier.static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWritercreate(XMLStreamWriter writer, EffectiveStatementInference inference) Create a new writer with the specified context and rooted at the specified node.static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWritercreate(XMLStreamWriter writer, EffectiveStatementInference inference, boolean preferPrefixes) Create a new writer with the specified context and rooted at the specified node.static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWritercreateSchemaless(XMLStreamWriter writer) Create a new schema-less writer.final voidflush()static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterforInputOf(XMLStreamWriter writer, EffectiveModelContext context, SchemaNodeIdentifier.Absolute operationPath) Create a new writer with the specified context and rooted in the specified operation's input.static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterforInputOf(XMLStreamWriter writer, EffectiveModelContext context, SchemaNodeIdentifier.Absolute operationPath, boolean preferPrefixes) Create a new writer with the specified context and rooted in the specified operation's input.static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterforOutputOf(XMLStreamWriter writer, EffectiveModelContext context, SchemaNodeIdentifier.Absolute operationPath) Create a new writer with the specified context and rooted in the specified operation's output.static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterforOutputOf(XMLStreamWriter writer, EffectiveModelContext context, SchemaNodeIdentifier.Absolute operationPath, boolean preferPrefixes) Create a new writer with the specified context and rooted in the specified operation's output.final voidfinal booleanstartAnydataNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, Class<?> objectModel) final voidstartMapEntryNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, int childSizeHint) final voidstartMapNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) final voidstartOrderedMapNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) final voidstartUnkeyedList(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) final voidstartUnkeyedListItem(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) final List<org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.MetadataExtension>Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opendaylight.yangtools.concepts.ExtensibleObject
extension, findExtensionMethods inherited from interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
domSourceValue, endNode, nextDataSchemaNode, scalarValue, startAnyxmlNode, startChoiceNode, startContainerNode, startLeafNode, startLeafSet, startLeafSetEntryNode, startOrderedLeafSetMethods inherited from interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.MetadataExtension
requireMetadataFirst
-
Method Details
-
create
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter create(XMLStreamWriter writer, EffectiveModelContext context) Create a new writer with the specified context as its root.- Parameters:
writer- OutputXMLStreamWritercontext- AssociatedEffectiveModelContext.- Returns:
- A new
NormalizedNodeStreamWriter
-
create
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter create(XMLStreamWriter writer, EffectiveModelContext context, boolean preferPrefixes) Create a new writer with the specified context as its root.- Parameters:
writer- OutputXMLStreamWritercontext- AssociatedEffectiveModelContext.preferPrefixes- prefer prefixes known tocontext- Returns:
- A new
NormalizedNodeStreamWriter
-
create
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter create(XMLStreamWriter writer, EffectiveStatementInference inference) Create a new writer with the specified context and rooted at the specified node.- Parameters:
writer- OutputXMLStreamWriterinference- root node inference- Returns:
- A new
NormalizedNodeStreamWriter
-
create
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter create(XMLStreamWriter writer, EffectiveStatementInference inference, boolean preferPrefixes) Create a new writer with the specified context and rooted at the specified node.- Parameters:
writer- OutputXMLStreamWriterinference- root node inferencepreferPrefixes- prefer prefixes known tocontext- Returns:
- A new
NormalizedNodeStreamWriter
-
create
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter create(XMLStreamWriter writer, EffectiveModelContext context, @Nullable SchemaNodeIdentifier.Absolute path) Create a new writer with the specified context and rooted in the specified schema path.- Parameters:
writer- OutputXMLStreamWritercontext- AssociatedEffectiveModelContext.path- path- Returns:
- A new
NormalizedNodeStreamWriter
-
create
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter create(XMLStreamWriter writer, EffectiveModelContext context, @Nullable SchemaNodeIdentifier.Absolute path, boolean preferPrefixes) Create a new writer with the specified context and rooted in the specified schema path.- Parameters:
writer- OutputXMLStreamWritercontext- AssociatedEffectiveModelContext.path- pathpreferPrefixes- prefer prefixes known tocontext- Returns:
- A new
NormalizedNodeStreamWriter
-
create
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter create(XMLStreamWriter writer, EffectiveModelContext context, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path) Create a new writer with the specified context and rooted in the specifiedYangInstanceIdentifier.- Parameters:
writer- OutputXMLStreamWritercontext- AssociatedEffectiveModelContext.path- path- Returns:
- A new
NormalizedNodeStreamWriter
-
create
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter create(XMLStreamWriter writer, EffectiveModelContext context, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path, boolean preferPrefixes) Create a new writer with the specified context and rooted in the specifiedYangInstanceIdentifier.- Parameters:
writer- OutputXMLStreamWritercontext- AssociatedEffectiveModelContext.path- pathpreferPrefixes- prefer prefixes known tocontext- Returns:
- A new
NormalizedNodeStreamWriter
-
forInputOf
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter forInputOf(XMLStreamWriter writer, EffectiveModelContext context, SchemaNodeIdentifier.Absolute operationPath) Create a new writer with the specified context and rooted in the specified operation's input.- Parameters:
writer- OutputXMLStreamWritercontext- AssociatedEffectiveModelContext.operationPath- Parent operation (RPC or action) path.- Returns:
- A new
NormalizedNodeStreamWriter
-
forInputOf
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter forInputOf(XMLStreamWriter writer, EffectiveModelContext context, SchemaNodeIdentifier.Absolute operationPath, boolean preferPrefixes) Create a new writer with the specified context and rooted in the specified operation's input.- Parameters:
writer- OutputXMLStreamWritercontext- AssociatedEffectiveModelContext.operationPath- Parent operation (RPC or action) path.preferPrefixes- prefer prefixes known tocontext- Returns:
- A new
NormalizedNodeStreamWriter
-
forOutputOf
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter forOutputOf(XMLStreamWriter writer, EffectiveModelContext context, SchemaNodeIdentifier.Absolute operationPath) Create a new writer with the specified context and rooted in the specified operation's output.- Parameters:
writer- OutputXMLStreamWritercontext- AssociatedEffectiveModelContext.operationPath- Parent operation (RPC or action) path.- Returns:
- A new
NormalizedNodeStreamWriter
-
forOutputOf
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter forOutputOf(XMLStreamWriter writer, EffectiveModelContext context, SchemaNodeIdentifier.Absolute operationPath, boolean preferPrefixes) Create a new writer with the specified context and rooted in the specified operation's output.- Parameters:
writer- OutputXMLStreamWritercontext- AssociatedEffectiveModelContext.operationPath- Parent operation (RPC or action) path.preferPrefixes- prefer prefixes known tocontext- Returns:
- A new
NormalizedNodeStreamWriter
-
createSchemaless
public static @NonNull org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter createSchemaless(XMLStreamWriter writer) Create a new schema-less writer. Note that this version is intended for debugging where doesn't have a SchemaContext available and isn't meant for production use.- Parameters:
writer- OutputXMLStreamWriter- Returns:
- A new
NormalizedNodeStreamWriter
-
supportedExtensions
public final List<org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.MetadataExtension> supportedExtensions()- Specified by:
supportedExtensionsin interfaceExtensibleObject<org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter,org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.Extension>
-
startUnkeyedListItem
public final void startUnkeyedListItem(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException - Specified by:
startUnkeyedListItemin interfaceorg.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter- Throws:
IOException
-
startMapEntryNode
public final void startMapEntryNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, int childSizeHint) throws IOException - Specified by:
startMapEntryNodein interfaceorg.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter- Throws:
IOException
-
startUnkeyedList
public final void startUnkeyedList(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) - Specified by:
startUnkeyedListin interfaceorg.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
-
startMapNode
public final void startMapNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) - Specified by:
startMapNodein interfaceorg.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
-
startOrderedMapNode
public final void startOrderedMapNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) - Specified by:
startOrderedMapNodein interfaceorg.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Specified by:
flushin interfaceorg.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter- Throws:
IOException
-
metadata
public final void metadata(com.google.common.collect.ImmutableMap<QName, Object> attributes) throws IOException- Specified by:
metadatain interfaceorg.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.MetadataExtension- Throws:
IOException
-
startAnydataNode
public final boolean startAnydataNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier name, Class<?> objectModel) throws IOException - Specified by:
startAnydataNodein interfaceorg.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter- Throws:
IOException
-