Remove redundant modifiers
[yangtools.git] / yang / yang-data-util / src / main / java / org / opendaylight / yangtools / yang / data / util / DataSchemaContextNode.java
index 050255e921b5ddac6595328afcde71c507b09a36..5412700e84d0c1146772ca6261f785a60c49127d 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.AugmentationTarget;
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
@@ -51,7 +51,7 @@ public abstract class DataSchemaContextNode<T extends PathArgument> implements I
     @Override
     public T getIdentifier() {
         return identifier;
-    };
+    }
 
     protected DataSchemaContextNode(final T identifier, final SchemaNode schema) {
         super();
@@ -75,22 +75,22 @@ public abstract class DataSchemaContextNode<T extends PathArgument> implements I
         return Collections.singleton(identifier.getNodeType());
     }
 
-    public abstract @Nullable DataSchemaContextNode<?> getChild(final PathArgument child);
-
-    public abstract @Nullable DataSchemaContextNode<?> getChild(QName child);
+    @Nullable public abstract DataSchemaContextNode<?> getChild(final PathArgument child);
+              
+    @Nullable public abstract DataSchemaContextNode<?> getChild(QName child);
 
     public abstract boolean isLeaf();
 
 
-    public @Nullable DataSchemaNode getDataSchemaNode() {
+    @Nullable public DataSchemaNode getDataSchemaNode() {
         return dataSchemaNode;
     }
 
-    static final DataSchemaNode findChildSchemaNode(final DataNodeContainer parent, final QName child) {
+    static DataSchemaNode findChildSchemaNode(final DataNodeContainer parent, final QName child) {
         DataSchemaNode potential = parent.getDataChildByName(child);
         if (potential == null) {
-            Iterable<org.opendaylight.yangtools.yang.model.api.ChoiceNode> choices = FluentIterable.from(
-                    parent.getChildNodes()).filter(ChoiceNode.class);
+            Iterable<ChoiceSchemaNode> choices = FluentIterable.from(
+                    parent.getChildNodes()).filter(ChoiceSchemaNode.class);
             potential = findChoice(choices, child);
         }
         return potential;
@@ -99,16 +99,15 @@ public abstract class DataSchemaContextNode<T extends PathArgument> implements I
     static DataSchemaContextNode<?> fromSchemaAndQNameChecked(final DataNodeContainer schema, final QName child) {
         DataSchemaNode result = findChildSchemaNode(schema, child);
         // We try to look up if this node was added by augmentation
-        if ((schema instanceof DataSchemaNode) && result.isAugmenting()) {
+        if (result != null && (schema instanceof DataSchemaNode) && result.isAugmenting()) {
             return fromAugmentation(schema, (AugmentationTarget) schema, result);
         }
         return fromDataSchemaNode(result);
     }
 
-    private static org.opendaylight.yangtools.yang.model.api.ChoiceNode findChoice(
-            final Iterable<org.opendaylight.yangtools.yang.model.api.ChoiceNode> choices, final QName child) {
-        org.opendaylight.yangtools.yang.model.api.ChoiceNode foundChoice = null;
-        choiceLoop: for (org.opendaylight.yangtools.yang.model.api.ChoiceNode choice : choices) {
+    private static ChoiceSchemaNode findChoice(final Iterable<ChoiceSchemaNode> choices, final QName child) {
+        ChoiceSchemaNode foundChoice = null;
+        choiceLoop: for (ChoiceSchemaNode choice : choices) {
             for (ChoiceCaseNode caze : choice.getCases()) {
                 if (findChildSchemaNode(caze, child) != null) {
                     foundChoice = choice;
@@ -150,7 +149,7 @@ public abstract class DataSchemaContextNode<T extends PathArgument> implements I
      * @param child
      * @return
      */
-    static @Nullable DataSchemaContextNode<?> fromAugmentation(final DataNodeContainer parent,
+    @Nullable static DataSchemaContextNode<?> fromAugmentation(final DataNodeContainer parent,
             final AugmentationTarget parentAug, final DataSchemaNode child) {
         AugmentationSchema augmentation = null;
         for (AugmentationSchema aug : parentAug.getAvailableAugmentations()) {
@@ -166,15 +165,15 @@ public abstract class DataSchemaContextNode<T extends PathArgument> implements I
         return fromDataSchemaNode(child);
     }
 
-    public static @Nullable DataSchemaContextNode<?> fromDataSchemaNode(final DataSchemaNode potential) {
+    @Nullable public static DataSchemaContextNode<?> fromDataSchemaNode(final DataSchemaNode potential) {
         if (potential instanceof ContainerSchemaNode) {
             return new ContainerContextNode((ContainerSchemaNode) potential);
         } else if (potential instanceof ListSchemaNode) {
             return fromListSchemaNode((ListSchemaNode) potential);
         } else if (potential instanceof LeafSchemaNode) {
             return new LeafContextNode((LeafSchemaNode) potential);
-        } else if (potential instanceof org.opendaylight.yangtools.yang.model.api.ChoiceNode) {
-            return new ChoiceNodeContextNode((org.opendaylight.yangtools.yang.model.api.ChoiceNode) potential);
+        } else if (potential instanceof ChoiceSchemaNode) {
+            return new ChoiceNodeContextNode((ChoiceSchemaNode) potential);
         } else if (potential instanceof LeafListSchemaNode) {
             return fromLeafListSchemaNode((LeafListSchemaNode) potential);
         } else if (potential instanceof AnyXmlSchemaNode) {