import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.ModifyAction;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
* Base strategy for converting an instance identifier into a normalized node structure for leaf and leaf-list types.
*/
-abstract class InstanceIdToSimpleNodes<T extends YangInstanceIdentifier.PathArgument> extends InstanceIdToNodes<T> {
+abstract class InstanceIdToSimpleNodes<T extends PathArgument> extends InstanceIdToNodes<T> {
protected InstanceIdToSimpleNodes(final T identifier) {
super(identifier);
@Override
public NormalizedNode<?, ?> create(final YangInstanceIdentifier instanceId, final Optional<NormalizedNode<?, ?>> deepestChild, final Optional<Map.Entry<QName,ModifyAction>> operation) {
checkNotNull(instanceId);
- final YangInstanceIdentifier.PathArgument pathArgument = instanceId.getPathArguments().get(0);
- final NormalizedNodeAttrBuilder<? extends YangInstanceIdentifier.PathArgument, Object, ? extends NormalizedNode<? extends YangInstanceIdentifier.PathArgument, Object>> builder = getBuilder(pathArgument);
+ final PathArgument pathArgument = instanceId.getPathArguments().get(0);
+ final NormalizedNodeAttrBuilder<? extends PathArgument, Object, ? extends NormalizedNode<? extends PathArgument, Object>> builder = getBuilder(pathArgument);
if(deepestChild.isPresent()) {
builder.withValue(deepestChild.get().getValue());
return builder.build();
}
- protected abstract NormalizedNodeAttrBuilder<? extends YangInstanceIdentifier.PathArgument, Object, ? extends NormalizedNode<? extends YangInstanceIdentifier.PathArgument, Object>> getBuilder(YangInstanceIdentifier.PathArgument node);
+ protected abstract NormalizedNodeAttrBuilder<? extends PathArgument, Object, ? extends NormalizedNode<? extends PathArgument, Object>> getBuilder(PathArgument node);
@Override
- public InstanceIdToNodes<?> getChild(final YangInstanceIdentifier.PathArgument child) {
+ public InstanceIdToNodes<?> getChild(final PathArgument child) {
return null;
}
- static final class LeafNormalization extends InstanceIdToSimpleNodes<YangInstanceIdentifier.NodeIdentifier> {
+ static final class LeafNormalization extends InstanceIdToSimpleNodes<NodeIdentifier> {
protected LeafNormalization(final LeafSchemaNode potential) {
- super(new YangInstanceIdentifier.NodeIdentifier(potential.getQName()));
+ super(new NodeIdentifier(potential.getQName()));
}
@Override
- protected NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> getBuilder(final YangInstanceIdentifier.PathArgument node) {
+ protected NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> getBuilder(final PathArgument node) {
return Builders.leafBuilder().withNodeIdentifier(getIdentifier());
}
}
}
- static final class LeafListEntryNormalization extends InstanceIdToSimpleNodes<YangInstanceIdentifier.NodeWithValue> {
+ static final class LeafListEntryNormalization extends InstanceIdToSimpleNodes<NodeWithValue> {
public LeafListEntryNormalization(final LeafListSchemaNode potential) {
- super(new YangInstanceIdentifier.NodeWithValue(potential.getQName(), null));
+ super(new YangInstanceIdentifier.NodeWithValue<>(potential.getQName(), null));
}
@Override
- protected NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>> getBuilder(final YangInstanceIdentifier.PathArgument node) {
+ protected NormalizedNodeAttrBuilder<NodeWithValue, Object, LeafSetEntryNode<Object>> getBuilder(final YangInstanceIdentifier.PathArgument node) {
Preconditions.checkArgument(node instanceof YangInstanceIdentifier.NodeWithValue);
- return Builders.leafSetEntryBuilder().withNodeIdentifier((YangInstanceIdentifier.NodeWithValue) node).withValue(((YangInstanceIdentifier.NodeWithValue) node).getValue());
+ return Builders.leafSetEntryBuilder().withNodeIdentifier((YangInstanceIdentifier.NodeWithValue<?>) node).withValue(((YangInstanceIdentifier.NodeWithValue<?>) node).getValue());
}
@Override