Class QNameTransformingStreamWriter
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter
-
- org.opendaylight.yangtools.transform.QNameTransformingStreamWriter
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
,ExtensibleObject<NormalizedNodeStreamWriter,NormalizedNodeStreamWriterExtension>
,NormalizedNodeStreamWriter
public abstract class QNameTransformingStreamWriter extends ForwardingNormalizedNodeStreamWriter
Stateless Normalized Node Stream Writer decorator, which performs QName translation.This class serves as base for Normalized Node Stream Writer decorators with option to transform QNames by user-implemented
transform(QName)
function.
-
-
Field Summary
-
Fields inherited from interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
UNKNOWN_SIZE
-
-
Constructor Summary
Constructors Constructor Description QNameTransformingStreamWriter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static NormalizedNodeStreamWriter
createQNameModuleReplacing(NormalizedNodeStreamWriter delegate, Map<QNameModule,QNameModule> mapping)
Returns decorator, which uses supplied map to transform QNameModules.static NormalizedNodeStreamWriter
createQNameReplacing(NormalizedNodeStreamWriter delegate, Map<QName,QName> mapping)
Returns decorator, which uses supplied map to transform QNames.static NormalizedNodeStreamWriter
fromFunction(NormalizedNodeStreamWriter delegate, Function<QName,QName> transformation)
Returns decorator, which uses supplied function to transform QNames.boolean
startAnyxmlNode(YangInstanceIdentifier.NodeIdentifier name, Class<?> objectModel)
Emits a start of anyxml node event.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
startLeafNode(YangInstanceIdentifier.NodeIdentifier name)
Emits a start of leaf node event.void
startLeafSet(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint)
Emits a start of system-ordered leaf set (leaf-list).void
startLeafSetEntryNode(YangInstanceIdentifier.NodeWithValue<?> name)
Emits a leaf set entry node.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 a user-ordered 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 abstract @NonNull QName
transform(@NonNull QName key)
Transforms a QName to new mapping.-
Methods inherited from class org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter
close, delegate, domSourceValue, endNode, flush, getExtensions, scalarValue, startAnydataNode
-
Methods inherited from class com.google.common.collect.ForwardingObject
toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
nextDataSchemaNode
-
-
-
-
Method Detail
-
fromFunction
public static NormalizedNodeStreamWriter fromFunction(NormalizedNodeStreamWriter delegate, Function<QName,QName> transformation)
Returns decorator, which uses supplied function to transform QNames.- Parameters:
delegate
- Underlying normalized node stream writertransformation
- Transformation function, function is required to return non-null values.- Returns:
- decorator, which uses supplied function to transform QNames.
-
createQNameReplacing
public static NormalizedNodeStreamWriter createQNameReplacing(NormalizedNodeStreamWriter delegate, Map<QName,QName> mapping)
Returns decorator, which uses supplied map to transform QNames. QNames not present in map are left unchanged.- Parameters:
delegate
- Underlying normalized node stream writermapping
- Immutable map which represent mapping from original to new values.- Returns:
- decorator, which uses supplied mapping to transform QNames.
-
createQNameModuleReplacing
public static NormalizedNodeStreamWriter createQNameModuleReplacing(NormalizedNodeStreamWriter delegate, Map<QNameModule,QNameModule> mapping)
Returns decorator, which uses supplied map to transform QNameModules. QNameModules not present in map are left unchanged.- Parameters:
delegate
- Underlying normalized node stream writermapping
- Immutable map which represent mapping from original to new values.- Returns:
- decorator, which uses supplied mapping to transform QNameModules.
-
startLeafNode
public void startLeafNode(YangInstanceIdentifier.NodeIdentifier name) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits a start of leaf node event.- Specified by:
startLeafNode
in interfaceNormalizedNodeStreamWriter
- Overrides:
startLeafNode
in classForwardingNormalizedNodeStreamWriter
- Parameters:
name
- name of node as defined in schema, namespace and revision are derived from parent node.- Throws:
IOException
- if an underlying IO error occurs
-
startLeafSet
public void startLeafSet(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits a start of system-ordered leaf set (leaf-list). While this entity is open, onlyNormalizedNodeStreamWriter.startLeafSetEntryNode(NodeWithValue)
calls are valid. Implementations are free to reorder entries within the leaf-list.- Specified by:
startLeafSet
in interfaceNormalizedNodeStreamWriter
- Overrides:
startLeafSet
in classForwardingNormalizedNodeStreamWriter
- Parameters:
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 orNormalizedNodeStreamWriter.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.- Throws:
IOException
- if an underlying IO error occurs
-
startOrderedLeafSet
public void startOrderedLeafSet(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits a start of a user-ordered leaf set (leaf-list). While this entity is open, onlyNormalizedNodeStreamWriter.startLeafSetEntryNode(NodeWithValue)
calls are valid. Implementations must retain the same entry order.- Specified by:
startOrderedLeafSet
in interfaceNormalizedNodeStreamWriter
- Overrides:
startOrderedLeafSet
in classForwardingNormalizedNodeStreamWriter
- Parameters:
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 orNormalizedNodeStreamWriter.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.- Throws:
IOException
- if an underlying IO error occurs
-
startLeafSetEntryNode
public void startLeafSetEntryNode(YangInstanceIdentifier.NodeWithValue<?> name) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits a leaf set entry node.- Specified by:
startLeafSetEntryNode
in interfaceNormalizedNodeStreamWriter
- Overrides:
startLeafSetEntryNode
in classForwardingNormalizedNodeStreamWriter
- Parameters:
name
- name of the node as defined in the schema.- Throws:
IOException
- if an underlying IO error occurs
-
startContainerNode
public void startContainerNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits start of new container. Valid sub-events are:NormalizedNodeStreamWriter.startLeafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)
NormalizedNodeStreamWriter.startAnyxmlNode(NodeIdentifier, Class)
NormalizedNodeStreamWriter.startContainerNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startChoiceNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startLeafSet(NodeIdentifier, int)
NormalizedNodeStreamWriter.startMapNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startUnkeyedList(NodeIdentifier, int)
NormalizedNodeStreamWriter.startAugmentationNode(AugmentationIdentifier)
- Specified by:
startContainerNode
in interfaceNormalizedNodeStreamWriter
- Overrides:
startContainerNode
in classForwardingNormalizedNodeStreamWriter
- Parameters:
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 orNormalizedNodeStreamWriter.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.- Throws:
IOException
- if an underlying IO error occurs
-
startUnkeyedList
public void startUnkeyedList(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits start of unkeyed list node event. Valid subevents is onlyNormalizedNodeStreamWriter.startUnkeyedListItem(NodeIdentifier, int)
.- Specified by:
startUnkeyedList
in interfaceNormalizedNodeStreamWriter
- Overrides:
startUnkeyedList
in classForwardingNormalizedNodeStreamWriter
- Parameters:
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 orNormalizedNodeStreamWriter.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.- Throws:
IOException
- if an underlying IO error occurs
-
startUnkeyedListItem
public void startUnkeyedListItem(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits start of new unkeyed list item. Valid sub-events are:NormalizedNodeStreamWriter.startLeafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)
NormalizedNodeStreamWriter.startContainerNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startChoiceNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startLeafSet(NodeIdentifier, int)
NormalizedNodeStreamWriter.startMapNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startUnkeyedList(NodeIdentifier, int)
NormalizedNodeStreamWriter.startAugmentationNode(AugmentationIdentifier)
- Specified by:
startUnkeyedListItem
in interfaceNormalizedNodeStreamWriter
- Overrides:
startUnkeyedListItem
in classForwardingNormalizedNodeStreamWriter
- Parameters:
name
- Identifier of nodechildSizeHint
- Non-negative count of expected direct child nodes orNormalizedNodeStreamWriter.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.- Throws:
IOException
- if an underlying IO error occurs
-
startMapNode
public void startMapNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits start of map node event. Valid subevent is onlyNormalizedNodeStreamWriter.startMapEntryNode(NodeIdentifierWithPredicates, int)
.- Specified by:
startMapNode
in interfaceNormalizedNodeStreamWriter
- Overrides:
startMapNode
in classForwardingNormalizedNodeStreamWriter
- Parameters:
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 orNormalizedNodeStreamWriter.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.- Throws:
IOException
- if an underlying IO error occurs
-
startMapEntryNode
public void startMapEntryNode(YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, int childSizeHint) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits start of map entry. Valid sub-events are:NormalizedNodeStreamWriter.startLeafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)
NormalizedNodeStreamWriter.startContainerNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startChoiceNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startLeafSet(NodeIdentifier, int)
NormalizedNodeStreamWriter.startMapNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startUnkeyedList(NodeIdentifier, int)
NormalizedNodeStreamWriter.startAugmentationNode(AugmentationIdentifier)
- Specified by:
startMapEntryNode
in interfaceNormalizedNodeStreamWriter
- Overrides:
startMapEntryNode
in classForwardingNormalizedNodeStreamWriter
- Parameters:
identifier
- QName to value pairs of keys of map entry node.childSizeHint
- Non-negative count of expected direct child nodes orNormalizedNodeStreamWriter.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.- Throws:
IOException
- if an underlying IO error occurs
-
startOrderedMapNode
public void startOrderedMapNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits start of map node event. Valid subevent is onlyNormalizedNodeStreamWriter.startMapEntryNode(NodeIdentifierWithPredicates, int)
.- Specified by:
startOrderedMapNode
in interfaceNormalizedNodeStreamWriter
- Overrides:
startOrderedMapNode
in classForwardingNormalizedNodeStreamWriter
- Parameters:
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 orNormalizedNodeStreamWriter.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.- Throws:
IOException
- if an underlying IO error occurs
-
startChoiceNode
public void startChoiceNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits start of a choice node event.- Specified by:
startChoiceNode
in interfaceNormalizedNodeStreamWriter
- Overrides:
startChoiceNode
in classForwardingNormalizedNodeStreamWriter
- Parameters:
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 orNormalizedNodeStreamWriter.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.- Throws:
IOException
- if an underlying IO error occurs
-
startAugmentationNode
public void startAugmentationNode(YangInstanceIdentifier.AugmentationIdentifier identifier) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits start of augmentation node. Valid sub-events are:NormalizedNodeStreamWriter.startLeafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)
NormalizedNodeStreamWriter.startContainerNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startChoiceNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startLeafSet(NodeIdentifier, int)
NormalizedNodeStreamWriter.startMapNode(NodeIdentifier, int)
NormalizedNodeStreamWriter.startUnkeyedList(NodeIdentifier, int)
- Specified by:
startAugmentationNode
in interfaceNormalizedNodeStreamWriter
- Overrides:
startAugmentationNode
in classForwardingNormalizedNodeStreamWriter
- Parameters:
identifier
- Augmentation identifier- Throws:
IOException
- if an underlying IO error occurs
-
startAnyxmlNode
public boolean startAnyxmlNode(YangInstanceIdentifier.NodeIdentifier name, Class<?> objectModel) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits a start of anyxml node event.- Specified by:
startAnyxmlNode
in interfaceNormalizedNodeStreamWriter
- Overrides:
startAnyxmlNode
in classForwardingNormalizedNodeStreamWriter
- Parameters:
name
- name of node as defined in schema, namespace and revision are derived from parent node.objectModel
- The object model of anyxml content- Returns:
- True if the specified object model is supported by this extension and the process of emitting the node has started. False if the object model is not supported and the node has not started to be emitted.
- Throws:
IOException
- if an underlying IO error occurs
-
startYangModeledAnyXmlNode
public void startYangModeledAnyXmlNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
Description copied from interface:NormalizedNodeStreamWriter
Emits start of new YANG-modeled anyxml node. Valid sub-events are:NormalizedNodeStreamWriter.startLeafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)
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)
- Specified by:
startYangModeledAnyXmlNode
in interfaceNormalizedNodeStreamWriter
- Overrides:
startYangModeledAnyXmlNode
in classForwardingNormalizedNodeStreamWriter
- Parameters:
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 orNormalizedNodeStreamWriter.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.- Throws:
IOException
- if an underlying IO error occurs
-
-