Add a couple of toString() implementations
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / InstanceIdToSimpleNodes.java
index ab62d4cc28f17f454f2936872cefb3c302d8bf13..e5d91fb3c8977ae5d03ac3e23a000eee05c681ce 100644 (file)
@@ -14,6 +14,9 @@ import java.util.Map;
 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;
@@ -24,7 +27,7 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 /**
 * 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);
@@ -33,8 +36,8 @@ abstract class InstanceIdToSimpleNodes<T extends YangInstanceIdentifier.PathArgu
     @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());
@@ -44,21 +47,21 @@ abstract class InstanceIdToSimpleNodes<T extends YangInstanceIdentifier.PathArgu
         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());
         }
 
@@ -68,16 +71,16 @@ abstract class InstanceIdToSimpleNodes<T extends YangInstanceIdentifier.PathArgu
         }
     }
 
-    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