import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.util.ClassLoaderUtils;
import org.opendaylight.yangtools.yang.binding.Action;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.BaseIdentity;
import org.opendaylight.yangtools.yang.binding.BaseNotification;
import org.opendaylight.yangtools.yang.binding.DataContainer;
final InstanceIdentifier<?> path, final NormalizedNodeStreamWriter domWriter) {
final var yangArgs = new ArrayList<YangInstanceIdentifier.PathArgument>();
final var codecContext = getCodecContextNode(path, yangArgs);
- return Map.entry(YangInstanceIdentifier.create(yangArgs),
+ return Map.entry(YangInstanceIdentifier.of(yangArgs),
new BindingToNormalizedStreamWriter(codecContext, domWriter));
}
return root.streamChild(childClass);
}
+ @Override
+ @SuppressWarnings("unchecked")
+ public <A extends Augmentation<?>> BindingAugmentationCodecTreeNode<A> getAugmentationCodec(
+ final InstanceIdentifier<A> path) {
+ final var codecContext = getCodecContextNode(path, null);
+ if (codecContext instanceof BindingAugmentationCodecTreeNode) {
+ return (BindingAugmentationCodecTreeNode<A>) codecContext;
+ }
+ throw new IllegalArgumentException(path + " does not refer to an Augmentation");
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends DataObject> BindingDataObjectCodecTreeNode<T> getDataObjectCodec(
+ final InstanceIdentifier<T> path) {
+ final var codecContext = getCodecContextNode(path, null);
+ if (codecContext instanceof BindingDataObjectCodecTreeNode) {
+ return (BindingDataObjectCodecTreeNode<T>) codecContext;
+ }
+ throw new IllegalArgumentException(path + " does not refer to a plain DataObject");
+ }
+
@Override
@SuppressWarnings("unchecked")
public <T extends DataObject> CodecWithPath<T> getSubtreeCodecWithPath(final InstanceIdentifier<T> path) {
// TODO Do we need defensive check here?
return new CodecWithPath<>((CommonDataObjectCodecTreeNode<T>) codecContext,
- YangInstanceIdentifier.create(yangArgs));
+ YangInstanceIdentifier.of(yangArgs));
}
@Override
// We create Binding Stream Writer which translates from Binding to Normalized Nodes
final var yangArgs = new ArrayList<YangInstanceIdentifier.PathArgument>();
final var codecContext = getCodecContextNode(path, yangArgs);
- final var yangPath = YangInstanceIdentifier.create(yangArgs);
+ final var yangPath = YangInstanceIdentifier.of(yangArgs);
// We create DOM stream writer which produces normalized nodes
final var result = new NormalizationResultHolder();