Class DataObjectCodecContext<D extends DataObject,T extends CompositeRuntimeType>
java.lang.Object
org.opendaylight.mdsal.binding.dom.codec.impl.DataObjectCodecContext<D,T>
- All Implemented Interfaces:
BindingCodecTreeNode
,BindingDataObjectCodecTreeNode<D>
,BindingDataObjectCodecTreeParent<Empty>
,BindingNormalizedNodeCodec<D>
,BindingObjectCodecTreeNode<D>
@Beta
public abstract class DataObjectCodecContext<D extends DataObject,T extends CompositeRuntimeType>
extends Object
This class is an implementation detail. It is public only due to technical reasons and may change at any time.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opendaylight.mdsal.binding.dom.codec.api.BindingDataObjectCodecTreeNode
BindingDataObjectCodecTreeNode.ChildAddressabilitySummary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addYangPathArgument
(InstanceIdentifier.PathArgument arg, List<YangInstanceIdentifier.PathArgument> builder) Serializes supplied Binding Path Argument and adds all necessary YANG instance identifiers to supplied list.protected final InstanceIdentifier.PathArgument
org.opendaylight.mdsal.binding.dom.codec.impl.DataContainerCodecContext<?,
?> bindingPathArgumentChild
(InstanceIdentifier.PathArgument arg, List<YangInstanceIdentifier.PathArgument> builder) Returns nested node context using supplied Binding Instance Identifier and adds YANG instance identifiers to supplied list.protected final <V> @NonNull V
childNonNull
(@Nullable V nullable, Class<?> childClass, String message, Object... args) protected final <V> @NonNull V
childNonNull
(@Nullable V nullable, QName child, String message, Object... args) protected final <V> @NonNull V
childNonNull
(@Nullable V nullable, YangInstanceIdentifier.PathArgument child, String message, Object... args) protected final @NonNull D
createBindingProxy
(DistinctNodeContainer<?, ?> node) createCachingCodec
(ImmutableCollection<Class<? extends BindingObject>> cacheSpecifier) Returns codec which uses caches serialization / deserialization results.protected abstract Object
deserializeObject
(NormalizedNode normalizedNode) Deserializes path argument for current node.protected final org.opendaylight.mdsal.binding.dom.codec.impl.NodeCodecContext.CodecContextFactory
factory()
Returns binding class of interface which represents API of current schema node.protected InstanceIdentifier.PathArgument
Returns deserialized Binding Path Argument from YANG instance identifier.Return a summary of addressability of potential children.protected YangInstanceIdentifier.PathArgument
Returns Yang Instance Identifier Path Argument of current node.protected final org.opendaylight.mdsal.binding.dom.codec.impl.ValueNodeCodecContext
getLeafChild
(String name) Return the schema node associated with this node.final T
getType()
protected final QNameModule
<C extends DataObject>
Optional<org.opendaylight.mdsal.binding.dom.codec.impl.DataContainerCodecContext<C,?>> possibleStreamChild
(Class<C> childClass) Returns child context as if it was walked byBindingStreamEventWriter
.Converts from Binding to Normalized Node representation of data.Serializes path argument for current node.<C extends DataObject>
org.opendaylight.mdsal.binding.dom.codec.impl.DataContainerCodecContext<C,?> streamChild
(Class<C> childClass) Returns child context as if it was walked byBindingStreamEventWriter
.toString()
void
writeAsNormalizedNode
(D data, NormalizedNodeStreamWriter writer) org.opendaylight.mdsal.binding.dom.codec.impl.NodeCodecContext
Returns nested node context using supplied YANG Instance Identifier.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeCodec
deserialize
-
Method Details
-
getSchema
Description copied from interface:BindingCodecTreeNode
Return the schema node associated with this node.- Returns:
- A schema node.
-
streamChild
public <C extends DataObject> org.opendaylight.mdsal.binding.dom.codec.impl.DataContainerCodecContext<C,?> streamChild(Class<C> childClass) Description copied from interface:BindingDataObjectCodecTreeParent
Returns child context as if it was walked byBindingStreamEventWriter
. This means that to enter case, one must issuestreamChild(ChoiceClass).streamChild(CaseClass)
.- Specified by:
streamChild
in interfaceBindingDataObjectCodecTreeParent<D extends DataObject>
- Type Parameters:
C
- Stream child DataObject type- Parameters:
childClass
- Child class by Binding Stream navigation- Returns:
- Context of child
-
possibleStreamChild
public <C extends DataObject> Optional<org.opendaylight.mdsal.binding.dom.codec.impl.DataContainerCodecContext<C,?>> possibleStreamChild(Class<C> childClass) Returns child context as if it was walked byBindingStreamEventWriter
. This means that to enter case, one must issue getChild(ChoiceClass).getChild(CaseClass).- Specified by:
possibleStreamChild
in interfaceBindingDataObjectCodecTreeNode<D extends DataObject>
- Parameters:
childClass
- child class- Returns:
- Context of child or Optional.empty is supplied class is not applicable in context.
-
bindingPathArgumentChild
public org.opendaylight.mdsal.binding.dom.codec.impl.DataContainerCodecContext<?,?> bindingPathArgumentChild(InstanceIdentifier.PathArgument arg, List<YangInstanceIdentifier.PathArgument> builder) Returns nested node context using supplied Binding Instance Identifier and adds YANG instance identifiers to supplied list.- Specified by:
bindingPathArgumentChild
in interfaceBindingDataObjectCodecTreeNode<D extends DataObject>
- Parameters:
arg
- Binding Instance Identifier Argumentbuilder
- Mutable instance of list, which is appended by YangInstanceIdentifiers as tree is walked. Use null if such side-product is not needed.- Returns:
- Context of child or null if supplied
arg
does not represent valid child.
-
yangPathArgumentChild
public org.opendaylight.mdsal.binding.dom.codec.impl.NodeCodecContext yangPathArgumentChild(YangInstanceIdentifier.PathArgument arg) Returns nested node context using supplied YANG Instance Identifier.- Specified by:
yangPathArgumentChild
in interfaceBindingDataObjectCodecTreeNode<D extends DataObject>
- Parameters:
arg
- Yang Instance Identifier Argument- Returns:
- Context of child
-
getLeafChild
protected final org.opendaylight.mdsal.binding.dom.codec.impl.ValueNodeCodecContext getLeafChild(String name) -
createBindingProxy
-
deserializePathArgument
public InstanceIdentifier.PathArgument deserializePathArgument(YangInstanceIdentifier.PathArgument arg) Description copied from interface:BindingDataObjectCodecTreeNode
Deserializes path argument for current node.- Parameters:
arg
- Yang Path Argument, may be null if Yang Instance Identifier does not have representation for current node (e.g. case).- Returns:
- Binding Path Argument, may be null if Binding Instance Identifier does not have representation for current node (e.g. choice or case).
-
serializePathArgument
public YangInstanceIdentifier.PathArgument serializePathArgument(InstanceIdentifier.PathArgument arg) Description copied from interface:BindingDataObjectCodecTreeNode
Serializes path argument for current node.- Parameters:
arg
- Binding Path Argument, may be null if Binding Instance Identifier does not have representation for current node (e.g. choice or case).- Returns:
- Yang Path Argument, may be null if Yang Instance Identifier does not have representation for current node (e.g. case).
-
getType
-
getChildAddressabilitySummary
public final BindingDataObjectCodecTreeNode.ChildAddressabilitySummary getChildAddressabilitySummary()Description copied from interface:BindingDataObjectCodecTreeNode
Return a summary of addressability of potential children. Binding specification does not allow all DOM tree elements to be directly addressed, which means some recursive tree operations, like data tree changes do not have a one-to-one mapping from DOM to binding in all cases. This method provides an optimization hint to guide translation of data structures, allowing for fast paths when all children are known to either be addressable or non-addressable.- Specified by:
getChildAddressabilitySummary
in interfaceBindingDataObjectCodecTreeNode<D extends DataObject>
- Returns:
- Summary children addressability.
-
namespace
-
factory
protected final org.opendaylight.mdsal.binding.dom.codec.impl.NodeCodecContext.CodecContextFactory factory() -
getDomPathArgument
Returns Yang Instance Identifier Path Argument of current node.- Returns:
- DOM Path Argument of node
-
getBindingPathArgument
protected InstanceIdentifier.PathArgument getBindingPathArgument(YangInstanceIdentifier.PathArgument domArg) Returns deserialized Binding Path Argument from YANG instance identifier. -
bindingArg
-
getBindingClass
Description copied from interface:BindingDataObjectCodecTreeNode
Returns binding class of interface which represents API of current schema node. The result is same as invokingDataObject.implementedInterface()
on instance of data.- Specified by:
getBindingClass
in interfaceBindingDataObjectCodecTreeNode<D extends DataObject>
- Specified by:
getBindingClass
in interfaceBindingObjectCodecTreeNode<D extends DataObject>
- Returns:
- interface which defines API of binding representation of data.
-
toString
-
createCachingCodec
public BindingNormalizedNodeCachingCodec<D> createCachingCodec(ImmutableCollection<Class<? extends BindingObject>> cacheSpecifier) Description copied from interface:BindingDataObjectCodecTreeNode
Returns codec which uses caches serialization / deserialization results.Caching may introduce performance penalty to serialization / deserialization but may decrease use of heap for repetitive objects.
- Specified by:
createCachingCodec
in interfaceBindingDataObjectCodecTreeNode<D extends DataObject>
- Parameters:
cacheSpecifier
- Set of objects, for which cache may be in place- Returns:
- Codec which uses cache for serialization / deserialization.
-
childNonNull
protected final <V> @NonNull V childNonNull(@Nullable V nullable, YangInstanceIdentifier.PathArgument child, String message, Object... args) -
childNonNull
-
childNonNull
-
serialize
Description copied from interface:BindingNormalizedNodeCodec
Converts from Binding to Normalized Node representation of data.- Specified by:
serialize
in interfaceBindingNormalizedNodeCodec<D extends DataObject>
- Parameters:
data
- Binding representation of data- Returns:
- Normalized Node representation of data
-
writeAsNormalizedNode
- Specified by:
writeAsNormalizedNode
in interfaceBindingDataObjectCodecTreeNode<D extends DataObject>
-
addYangPathArgument
protected void addYangPathArgument(InstanceIdentifier.PathArgument arg, List<YangInstanceIdentifier.PathArgument> builder) Serializes supplied Binding Path Argument and adds all necessary YANG instance identifiers to supplied list.- Parameters:
arg
- Binding Path Argumentbuilder
- DOM Path argument.
-
deserializeObject
-