public abstract class JSONNormalizedNodeStreamWriter extends Object implements NormalizedNodeStreamWriter
Values of leaf and leaf-list are NOT translated according to codecs.
UNKNOWN_SIZE
Modifier and Type | Method and Description |
---|---|
void |
anyxmlNode(YangInstanceIdentifier.NodeIdentifier name,
Object value)
Emits anyxml node event.
|
static NormalizedNodeStreamWriter |
createExclusiveWriter(JSONCodecFactory codecFactory,
DataNodeContainer rootNode,
URI initialNs,
com.google.gson.stream.JsonWriter jsonWriter)
Create a new stream writer, which writes to the specified output stream.
|
static NormalizedNodeStreamWriter |
createExclusiveWriter(JSONCodecFactory codecFactory,
SchemaPath path,
URI initialNs,
com.google.gson.stream.JsonWriter jsonWriter)
Create a new stream writer, which writes to the specified output stream.
|
static NormalizedNodeStreamWriter |
createNestedWriter(JSONCodecFactory codecFactory,
DataNodeContainer rootNode,
URI initialNs,
com.google.gson.stream.JsonWriter jsonWriter)
Create a new stream writer, which writes to the specified output stream.
|
static NormalizedNodeStreamWriter |
createNestedWriter(JSONCodecFactory codecFactory,
SchemaPath path,
URI initialNs,
com.google.gson.stream.JsonWriter jsonWriter)
Create a new stream writer, which writes to the specified output stream.
|
void |
endNode()
Emits end event for node.
|
void |
flush() |
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 |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, nextDataSchemaNode
public static NormalizedNodeStreamWriter createExclusiveWriter(JSONCodecFactory codecFactory, SchemaPath path, URI initialNs, com.google.gson.stream.JsonWriter jsonWriter)
The codec factory can be reused between multiple writers.
Returned writer is exclusive user of JsonWriter, which means it will start top-level JSON element and ends it.
This instance of writer can be used only to emit one top level element, otherwise it will produce incorrect JSON. Closing this instance will close the writer too.
codecFactory
- JSON codec factorypath
- Schema PathinitialNs
- Initial namespacejsonWriter
- JsonWriterpublic static NormalizedNodeStreamWriter createExclusiveWriter(JSONCodecFactory codecFactory, DataNodeContainer rootNode, URI initialNs, com.google.gson.stream.JsonWriter jsonWriter)
The codec factory can be reused between multiple writers.
Returned writer is exclusive user of JsonWriter, which means it will start top-level JSON element and ends it.
This instance of writer can be used only to emit one top level element, otherwise it will produce incorrect JSON. Closing this instance will close the writer too.
codecFactory
- JSON codec factoryrootNode
- Root nodeinitialNs
- Initial namespacejsonWriter
- JsonWriterpublic static NormalizedNodeStreamWriter createNestedWriter(JSONCodecFactory codecFactory, SchemaPath path, URI initialNs, com.google.gson.stream.JsonWriter jsonWriter)
The codec factory can be reused between multiple writers.
Returned writer can be used emit multiple top level element,
but does not start / close parent JSON object, which must be done
by user providing jsonWriter
instance in order for
JSON to be valid. Closing this instance will not
close the wrapped writer; the caller must take care of that.
codecFactory
- JSON codec factorypath
- Schema PathinitialNs
- Initial namespacejsonWriter
- JsonWriterpublic static NormalizedNodeStreamWriter createNestedWriter(JSONCodecFactory codecFactory, DataNodeContainer rootNode, URI initialNs, com.google.gson.stream.JsonWriter jsonWriter)
The codec factory can be reused between multiple writers.
Returned writer can be used emit multiple top level element,
but does not start / close parent JSON object, which must be done
by user providing jsonWriter
instance in order for
JSON to be valid. Closing this instance will not
close the wrapped writer; the caller must take care of that.
codecFactory
- JSON codec factoryrootNode
- Root nodeinitialNs
- Initial namespacejsonWriter
- JsonWriterpublic final void leafNode(YangInstanceIdentifier.NodeIdentifier name, Object value) throws IOException
NormalizedNodeStreamWriter
leafNode
in interface NormalizedNodeStreamWriter
name
- name of node as defined in schema, namespace and revision are
derived from parent node.value
- Value of leaf node. vIOException
- if an underlying IO error occurspublic final void startLeafSet(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
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 NormalizedNodeStreamWriter
name
- 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.IOException
- if an underlying IO error occurspublic final void leafSetEntryNode(QName name, Object value) throws IOException
NormalizedNodeStreamWriter
leafSetEntryNode
in interface NormalizedNodeStreamWriter
name
- name of the node as defined in the schema.value
- Value of leaf set entry node. Supplied object MUST BE constant over time.IOException
- if an underlying IO error occurspublic final void startOrderedLeafSet(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
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 NormalizedNodeStreamWriter
name
- 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.IOException
- if an underlying IO error occurspublic final void startContainerNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
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 NormalizedNodeStreamWriter
name
- 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.IOException
- if an underlying IO error occurspublic final void startUnkeyedList(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
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 NormalizedNodeStreamWriter
name
- 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.IOException
- if an underlying IO error occurspublic final void startUnkeyedListItem(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
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 NormalizedNodeStreamWriter
name
- 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.IOException
- if an underlying IO error occurspublic final void startMapNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
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 NormalizedNodeStreamWriter
name
- 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.IOException
- if an underlying IO error occurspublic final void startMapEntryNode(YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, int childSizeHint) throws IOException
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 NormalizedNodeStreamWriter
identifier
- 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.IOException
- if an underlying IO error occurspublic final void startOrderedMapNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
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 NormalizedNodeStreamWriter
name
- 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.IOException
- if an underlying IO error occurspublic final void startChoiceNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
NormalizedNodeStreamWriter
startChoiceNode
in interface NormalizedNodeStreamWriter
name
- 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 final 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 NormalizedNodeStreamWriter
identifier
- Augmentation identifierpublic final void anyxmlNode(YangInstanceIdentifier.NodeIdentifier name, Object value) throws IOException
NormalizedNodeStreamWriter
anyxmlNode
in interface NormalizedNodeStreamWriter
name
- name of node as defined in schema, namespace and revision are
derived from parent node.value
- Value of AnyXml node.IOException
- if an underlying IO error occurspublic final void startYangModeledAnyXmlNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
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 NormalizedNodeStreamWriter
name
- 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.IOException
- if an underlying IO error occurspublic final void endNode() throws IOException
NormalizedNodeStreamWriter
endNode
in interface NormalizedNodeStreamWriter
IOException
- if an underlying IO error occurspublic final void flush() throws IOException
flush
in interface Flushable
flush
in interface NormalizedNodeStreamWriter
IOException
Copyright © 2019 OpenDaylight. All rights reserved.