Refactored SchemaPath for yang java types. Fixed SchemaPath for augmented nodes types.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / main / java / org / opendaylight / controller / yang / parser / builder / impl / ChoiceCaseBuilder.java
index d86db6d92046552c8d353f556dafbe830a2a4c72..11a1b3114c7475d27d9e049600aa788b9d47783e 100644 (file)
@@ -23,6 +23,7 @@ import org.opendaylight.controller.yang.parser.builder.api.AbstractChildNodeBuil
 import org.opendaylight.controller.yang.parser.builder.api.DataSchemaNodeBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.TypeDefinitionBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.UsesNodeBuilder;
+import org.opendaylight.controller.yang.parser.util.YangParseException;
 
 public final class ChoiceCaseBuilder extends AbstractChildNodeBuilder implements
         DataSchemaNodeBuilder {
@@ -151,13 +152,13 @@ public final class ChoiceCaseBuilder extends AbstractChildNodeBuilder implements
 
     @Override
     public void addTypedef(TypeDefinitionBuilder typedefBuilder) {
-        throw new UnsupportedOperationException(
+        throw new YangParseException(line,
                 "Can not add type definition to choice case.");
     }
 
     @Override
     public void setConfiguration(boolean configuration) {
-        throw new UnsupportedOperationException(
+        throw new YangParseException(line,
                 "Can not add config definition to choice case.");
     }
 
@@ -170,7 +171,7 @@ public final class ChoiceCaseBuilder extends AbstractChildNodeBuilder implements
         return augmentations;
     }
 
-    private class ChoiceCaseNodeImpl implements ChoiceCaseNode {
+    private final class ChoiceCaseNodeImpl implements ChoiceCaseNode {
         private final QName qname;
         private SchemaPath path;
         private String description;
@@ -264,6 +265,10 @@ public final class ChoiceCaseBuilder extends AbstractChildNodeBuilder implements
             }
         }
 
+        /**
+         * Always returns an empty set, because case node can not contains type
+         * definitions.
+         */
         @Override
         public Set<TypeDefinition<?>> getTypeDefinitions() {
             return Collections.emptySet();
@@ -372,7 +377,6 @@ public final class ChoiceCaseBuilder extends AbstractChildNodeBuilder implements
             sb.append("]");
             return sb.toString();
         }
-
     }
 
 }