public class ImmutableNormalizedNodeStreamWriter extends Object implements NormalizedNodeStreamWriter
NormalizedNodeStreamWriter, which constructs immutable instances of
NormalizedNodes.
This writer supports two modes of behaviour one is using from(NormalizedNodeResult) where resulting
NormalizedNode will be stored in supplied result object.
Other mode of operation is using from(NormalizedNodeContainerBuilder), where all created nodes will be
written to this builder.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ImmutableNormalizedNodeStreamWriter.NormalizedNodeResultBuilder |
UNKNOWN_SIZE| Modifier | Constructor and Description |
|---|---|
protected |
ImmutableNormalizedNodeStreamWriter(NormalizedNodeContainerBuilder topLevelBuilder) |
protected |
ImmutableNormalizedNodeStreamWriter(NormalizedNodeResult result) |
| Modifier and Type | Method and Description |
|---|---|
void |
anyxmlNode(YangInstanceIdentifier.NodeIdentifier name,
Object value)
Emits anyxml node event.
|
void |
close() |
void |
endNode()
Emits end event for node.
|
void |
flush() |
static @NonNull NormalizedNodeStreamWriter |
from(NormalizedNodeContainerBuilder<?,?,?,?> builder)
Creates a
NormalizedNodeStreamWriter which creates instances of supplied NormalizedNodes
and writes them to supplied builder as child nodes. |
static NormalizedNodeStreamWriter |
from(NormalizedNodeResult result)
Creates a
NormalizedNodeStreamWriter which creates one instance of top-level NormalizedNode
(type of NormalizedNode) is determined by first start event. |
protected Deque<NormalizedNodeContainerBuilder> |
getBuilders() |
protected NormalizedNodeContainerBuilder |
getCurrent() |
void |
leafNode(YangInstanceIdentifier.NodeIdentifier name,
Object value)
Emits a leaf node event with supplied value.
|
void |
leafSetEntryNode(QName name,
Object value)
Emits a leaf set entry node.
|
void |
nextDataSchemaNode(DataSchemaNode schema)
Attach the specified
DataSchemaNode to the next node which will get started or emitted. |
void |
startAugmentationNode(YangInstanceIdentifier.AugmentationIdentifier identifier)
Emits start of augmentation node.
|
void |
startChoiceNode(YangInstanceIdentifier.NodeIdentifier name,
int childSizeHint)
Emits start of a choice node event.
|
void |
startContainerNode(YangInstanceIdentifier.NodeIdentifier name,
int childSizeHint)
Emits start of new container.
|
void |
startLeafSet(YangInstanceIdentifier.NodeIdentifier name,
int childSizeHint)
Emits a start of leaf set (leaf-list).
|
void |
startMapEntryNode(YangInstanceIdentifier.NodeIdentifierWithPredicates identifier,
int childSizeHint)
Emits start of map entry.
|
void |
startMapNode(YangInstanceIdentifier.NodeIdentifier name,
int childSizeHint)
Emits start of map node event.
|
void |
startOrderedLeafSet(YangInstanceIdentifier.NodeIdentifier name,
int childSizeHint)
Emits a start of leaf set (leaf-list).
|
void |
startOrderedMapNode(YangInstanceIdentifier.NodeIdentifier name,
int childSizeHint)
Emits start of map node event.
|
void |
startUnkeyedList(YangInstanceIdentifier.NodeIdentifier name,
int childSizeHint)
Emits start of unkeyed list node event.
|
void |
startUnkeyedListItem(YangInstanceIdentifier.NodeIdentifier name,
int childSizeHint)
Emits start of new unkeyed list item.
|
void |
startYangModeledAnyXmlNode(YangInstanceIdentifier.NodeIdentifier name,
int childSizeHint)
Emits start of new yang modeled anyXml node.
|
protected void |
writeChild(NormalizedNode<?,?> child) |
protected ImmutableNormalizedNodeStreamWriter(NormalizedNodeContainerBuilder topLevelBuilder)
protected ImmutableNormalizedNodeStreamWriter(NormalizedNodeResult result)
public static @NonNull NormalizedNodeStreamWriter from(NormalizedNodeContainerBuilder<?,?,?,?> builder)
NormalizedNodeStreamWriter which creates instances of supplied NormalizedNodes
and writes them to supplied builder as child nodes.
Type of supplied NormalizedNodeContainerBuilder affects, which events could be emitted in order
to ensure proper construction of data.
builder - Builder to which data will be written.NormalizedNodeStreamWriter which writes datapublic static NormalizedNodeStreamWriter from(NormalizedNodeResult result)
NormalizedNodeStreamWriter which creates one instance of top-level NormalizedNode
(type of NormalizedNode) is determined by first start event.
Result is built when endNode() associated with that start event is emitted.
Writer properly creates also nested NormalizedNode instances, if their are supported inside the scope
of the first event.
This method is useful for clients, which knows there will be one top-level node written, but does not know which
type of NormalizedNode will be written.
result - NormalizedNodeResult object which will hold result value.NormalizedNodeStreamWriter which will write item to supplied result holder.protected Deque<NormalizedNodeContainerBuilder> getBuilders()
protected NormalizedNodeContainerBuilder getCurrent()
protected void writeChild(NormalizedNode<?,?> child)
public void endNode()
NormalizedNodeStreamWriterendNode in interface NormalizedNodeStreamWriterpublic void leafNode(YangInstanceIdentifier.NodeIdentifier name, Object value)
NormalizedNodeStreamWriterleafNode in interface NormalizedNodeStreamWritername - name of node as defined in schema, namespace and revision are
derived from parent node.value - Value of leaf node. vpublic void startLeafSet(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
NormalizedNodeStreamWriter
Emits start of leaf set, during writing leaf set event, only
NormalizedNodeStreamWriter.leafSetEntryNode(QName, Object) calls are valid. Leaf set event is
finished by calling NormalizedNodeStreamWriter.endNode().
startLeafSet in interface NormalizedNodeStreamWritername - name of node as defined in schema, namespace and revision are
derived from parent node.childSizeHint - Non-negative count of expected direct child nodes or
NormalizedNodeStreamWriter.UNKNOWN_SIZE if count is unknown. This is only hint
and should not fail writing of child events, if there are more
events than count.public void leafSetEntryNode(QName name, Object value)
NormalizedNodeStreamWriterleafSetEntryNode in interface NormalizedNodeStreamWritername - name of the node as defined in the schema.value - Value of leaf set entry node. Supplied object MUST BE constant over time.public void startOrderedLeafSet(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
NormalizedNodeStreamWriter
Emits start of leaf set, during writing leaf set event, only
NormalizedNodeStreamWriter.leafSetEntryNode(QName, Object) calls are valid. Leaf set event is
finished by calling NormalizedNodeStreamWriter.endNode().
startOrderedLeafSet in interface NormalizedNodeStreamWritername - name of node as defined in schema, namespace and revision are
derived from parent node.childSizeHint - Non-negative count of expected direct child nodes or
NormalizedNodeStreamWriter.UNKNOWN_SIZE if count is unknown. This is only hint
and should not fail writing of child events, if there are more
events than count.public void anyxmlNode(YangInstanceIdentifier.NodeIdentifier name, Object value)
NormalizedNodeStreamWriteranyxmlNode in interface NormalizedNodeStreamWritername - name of node as defined in schema, namespace and revision are
derived from parent node.value - Value of AnyXml node.public void startContainerNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
NormalizedNodeStreamWriter
End of container event is emitted by invoking NormalizedNodeStreamWriter.endNode().
Valid sub-events are:
NormalizedNodeStreamWriter.leafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, java.lang.Object)#startContainerNode(NodeIdentifier, int)#startChoiceNode(NodeIdentifier, int)#startLeafSet(NodeIdentifier, int)#startMapNode(NodeIdentifier, int)#startUnkeyedList(NodeIdentifier, int)#startAugmentationNode(AugmentationIdentifier)startContainerNode in interface NormalizedNodeStreamWritername - name of node as defined in schema, namespace and revision are
derived from parent node.childSizeHint - Non-negative count of expected direct child nodes or
NormalizedNodeStreamWriter.UNKNOWN_SIZE if count is unknown. This is only hint
and should not fail writing of child events, if there are more
events than count.public void startYangModeledAnyXmlNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
NormalizedNodeStreamWriter
End of yang modeled anyXml node event is emitted by invoking NormalizedNodeStreamWriter.endNode().
Valid sub-events are:
NormalizedNodeStreamWriter.leafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, java.lang.Object)NormalizedNodeStreamWriter.startContainerNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, int)NormalizedNodeStreamWriter.startLeafSet(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, int)NormalizedNodeStreamWriter.startMapNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, int)NormalizedNodeStreamWriter.startUnkeyedList(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, int)startYangModeledAnyXmlNode in interface NormalizedNodeStreamWritername - name of node as defined in schema, namespace and revision are
derived from parent node.childSizeHint - Non-negative count of expected direct child nodes or
NormalizedNodeStreamWriter.UNKNOWN_SIZE if count is unknown. This is only hint
and should not fail writing of child events, if there are more
events than count.public void startUnkeyedList(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
NormalizedNodeStreamWriter
End of unkeyed list event is emitted by invoking NormalizedNodeStreamWriter.endNode().
Valid subevents is only #startUnkeyedListItem(NodeIdentifier, int). All other
methods will throw IllegalArgumentException.
startUnkeyedList in interface NormalizedNodeStreamWritername - name of node as defined in schema, namespace and revision are
derived from parent node.childSizeHint - Non-negative count of expected direct child nodes or
NormalizedNodeStreamWriter.UNKNOWN_SIZE if count is unknown. This is only hint
and should not fail writing of child events, if there are more
events than count.public void startUnkeyedListItem(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
NormalizedNodeStreamWriter
Unkeyed list item event is finished by invoking NormalizedNodeStreamWriter.endNode(). Valid
sub-events are:
NormalizedNodeStreamWriter.leafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, java.lang.Object)#startContainerNode(NodeIdentifier, int)#startChoiceNode(NodeIdentifier, int)#startLeafSet(NodeIdentifier, int)#startMapNode(NodeIdentifier, int)#startUnkeyedList(NodeIdentifier, int)#startAugmentationNode(AugmentationIdentifier)startUnkeyedListItem in interface NormalizedNodeStreamWritername - Identifier of nodechildSizeHint - Non-negative count of expected direct child nodes or
NormalizedNodeStreamWriter.UNKNOWN_SIZE if count is unknown. This is only hint
and should not fail writing of child events, if there are more
events than count.public void startMapNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
NormalizedNodeStreamWriter
End of map node event is emitted by invoking NormalizedNodeStreamWriter.endNode(). Valid
subevents is only
#startMapEntryNode(NodeIdentifierWithPredicates, int). All other
methods will throw IllegalArgumentException.
startMapNode in interface NormalizedNodeStreamWritername - name of node as defined in schema, namespace and revision are
derived from parent node.childSizeHint - Non-negative count of expected direct child nodes or
NormalizedNodeStreamWriter.UNKNOWN_SIZE if count is unknown. This is only hint
and should not fail writing of child events, if there are more
events than count.public void startMapEntryNode(YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, int childSizeHint)
NormalizedNodeStreamWriter
End of map entry event is emitted by invoking NormalizedNodeStreamWriter.endNode().
Valid sub-events are:
NormalizedNodeStreamWriter.leafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, java.lang.Object)#startContainerNode(NodeIdentifier, int)#startChoiceNode(NodeIdentifier, int)#startLeafSet(NodeIdentifier, int)#startMapNode(NodeIdentifier, int)#startUnkeyedList(NodeIdentifier, int)#startAugmentationNode(AugmentationIdentifier)startMapEntryNode in interface NormalizedNodeStreamWriteridentifier - QName to value pairs of keys of map entry node. Values MUST BE constant over time.childSizeHint - Non-negative count of expected direct child nodes or
NormalizedNodeStreamWriter.UNKNOWN_SIZE if count is unknown. This is only hint
and should not fail writing of child events, if there are more
events than count.public void startOrderedMapNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
NormalizedNodeStreamWriter
End of map node event is emitted by invoking NormalizedNodeStreamWriter.endNode(). Valid
subevents is only
#startMapEntryNode(NodeIdentifierWithPredicates, int). All other
methods will throw IllegalArgumentException.
startOrderedMapNode in interface NormalizedNodeStreamWritername - name of node as defined in schema, namespace and revision are
derived from parent node.childSizeHint - Non-negative count of expected direct child nodes or
NormalizedNodeStreamWriter.UNKNOWN_SIZE if count is unknown. This is only hint
and should not fail writing of child events, if there are more
events than count.public void startChoiceNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
NormalizedNodeStreamWriterstartChoiceNode in interface NormalizedNodeStreamWritername - name of node as defined in schema, namespace and revision are
derived from parent node.childSizeHint - Non-negative count of expected direct child nodes or
NormalizedNodeStreamWriter.UNKNOWN_SIZE if count is unknown. This is only hint
and should not fail writing of child events, if there are more
events than count.public void startAugmentationNode(YangInstanceIdentifier.AugmentationIdentifier identifier)
NormalizedNodeStreamWriter
End of augmentation event is emitted by invoking NormalizedNodeStreamWriter.endNode().
Valid sub-events are:
NormalizedNodeStreamWriter.leafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, java.lang.Object)#startContainerNode(NodeIdentifier, int)#startChoiceNode(NodeIdentifier, int)#startLeafSet(NodeIdentifier, int)#startMapNode(NodeIdentifier, int)#startUnkeyedList(NodeIdentifier, int)startAugmentationNode in interface NormalizedNodeStreamWriteridentifier - Augmentation identifierpublic void flush()
flush in interface Flushableflush in interface NormalizedNodeStreamWriterpublic void close()
close in interface Closeableclose in interface AutoCloseableclose in interface NormalizedNodeStreamWriterpublic void nextDataSchemaNode(DataSchemaNode schema)
NormalizedNodeStreamWriterDataSchemaNode to the next node which will get started or emitted. The default
implementation does nothing.nextDataSchemaNode in interface NormalizedNodeStreamWriterschema - DataSchemaNodeCopyright © 2019 OpenDaylight. All rights reserved.