Class ReusableNormalizedNodePruner
- java.lang.Object
-
- org.opendaylight.controller.cluster.datastore.node.utils.transformer.ReusableNormalizedNodePruner
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
,ExtensibleObject<NormalizedNodeStreamWriter,NormalizedNodeStreamWriterExtension>
,NormalizedNodeStreamWriter
@Beta public abstract class ReusableNormalizedNodePruner extends Object
The NormalizedNodePruner removes all nodes from the input NormalizedNode that do not have a corresponding schema element in the passed in SchemaContext. Instances of this class can be reused multiple times and must be initialized before each use throughinitializeForPath(YangInstanceIdentifier)
.
-
-
Field Summary
-
Fields inherited from interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
UNKNOWN_SIZE
-
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opendaylight.yangtools.concepts.ExtensibleObject
getExtensions
-
Methods inherited from interface org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter
nextDataSchemaNode
-
-
-
-
Method Detail
-
forSchemaContext
public static @NonNull ReusableNormalizedNodePruner forSchemaContext(SchemaContext schemaContext)
Create a new pruner bound to a SchemaContext.- Parameters:
schemaContext
- SchemaContext to use- Returns:
- A new uninitialized pruner
- Throws:
NullPointerException
- ifschemaContext
is null
-
forDataSchemaContext
public static @NonNull ReusableNormalizedNodePruner forDataSchemaContext(DataSchemaContextTree tree)
Create a new pruner bound to a DataSchemaContextTree. This is a more efficient alternative offorSchemaContext(SchemaContext)
.- Parameters:
tree
- DataSchemaContextTree to use- Returns:
- A new uninitialized pruner
- Throws:
NullPointerException
- ifschemaContext
is null
-
duplicate
public abstract @NonNull ReusableNormalizedNodePruner duplicate()
Return a new instance, which is backed but the same DataSchemaContextTree, but does not share any state and is uninitialized. This is equivalent toforDataSchemaContext(DataSchemaContextTree)
and is provided for convenience.- Returns:
- A new uninitialized pruner bound to the same SchemaContext as this one.
-
initializeForPath
public final void initializeForPath(YangInstanceIdentifier path)
Initialize this pruner for processing a node at specified path.- Parameters:
path
- Path that will be processed next- Throws:
NullPointerException
- ifpath
is null
-
withUintAdaption
public final @NonNull ReusableNormalizedNodePruner withUintAdaption()
-
startLeafNode
public final void startLeafNode(YangInstanceIdentifier.NodeIdentifier name) throws IOException
- Specified by:
startLeafNode
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startLeafSet
public final void startLeafSet(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
- Specified by:
startLeafSet
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startOrderedLeafSet
public final void startOrderedLeafSet(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
- Specified by:
startOrderedLeafSet
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startLeafSetEntryNode
public void startLeafSetEntryNode(YangInstanceIdentifier.NodeWithValue<?> name) throws IOException
- Specified by:
startLeafSetEntryNode
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startContainerNode
public final void startContainerNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
- Specified by:
startContainerNode
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startYangModeledAnyXmlNode
public final void startYangModeledAnyXmlNode(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, int count)
- Specified by:
startYangModeledAnyXmlNode
in interfaceNormalizedNodeStreamWriter
-
startUnkeyedList
public final void startUnkeyedList(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
- Specified by:
startUnkeyedList
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startUnkeyedListItem
public final void startUnkeyedListItem(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
- Specified by:
startUnkeyedListItem
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startMapNode
public final void startMapNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
- Specified by:
startMapNode
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startMapEntryNode
public void startMapEntryNode(YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, int childSizeHint) throws IOException
- Specified by:
startMapEntryNode
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startOrderedMapNode
public final void startOrderedMapNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
- Specified by:
startOrderedMapNode
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startChoiceNode
public final void startChoiceNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException
- Specified by:
startChoiceNode
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startAugmentationNode
public final void startAugmentationNode(YangInstanceIdentifier.AugmentationIdentifier identifier) throws IOException
- Specified by:
startAugmentationNode
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startAnyxmlNode
public final boolean startAnyxmlNode(YangInstanceIdentifier.NodeIdentifier name, Class<?> objectModel) throws IOException
- Specified by:
startAnyxmlNode
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
startAnydataNode
public final boolean startAnydataNode(YangInstanceIdentifier.NodeIdentifier name, Class<?> objectModel) throws IOException
- Specified by:
startAnydataNode
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
domSourceValue
public final void domSourceValue(DOMSource value) throws IOException
- Specified by:
domSourceValue
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
scalarValue
public final void scalarValue(Object value) throws IOException
- Specified by:
scalarValue
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
endNode
public final void endNode() throws IOException
- Specified by:
endNode
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
close
public final void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
flush
public final void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in interfaceNormalizedNodeStreamWriter
- Throws:
IOException
-
getResult
public final Optional<NormalizedNode<?,?>> getResult()
Return the resulting normalized node.- Returns:
- Resulting node for the path, if it was not pruned
- Throws:
IllegalStateException
- if this pruner has not been closed
-
-