Rework AugmentRuntimeType and Choice/Case linkage
[mdsal.git] / binding / mdsal-binding-generator / src / main / java / org / opendaylight / mdsal / binding / generator / impl / reactor / LeafListGenerator.java
index e9f744db9a337e098ebfbab48a6ca93ff5e67b0e..aa6263a192696b724237e364020118151b64c883 100644 (file)
@@ -13,7 +13,6 @@ import org.opendaylight.mdsal.binding.model.ri.Types;
 import org.opendaylight.mdsal.binding.runtime.api.LeafListRuntimeType;
 import org.opendaylight.yangtools.yang.common.Ordering;
 import org.opendaylight.yangtools.yang.model.api.stmt.LeafListEffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByEffectiveStatement;
 
 /**
  * Generator corresponding to a {@code leaf-list} statement.
@@ -30,25 +29,21 @@ final class LeafListGenerator
         // List<Object>, we will try to narrow the return type in subclasses.
         final Type type = super.methodReturnType(builderFactory);
         final boolean isObject = Types.objectType().equals(type);
-        final Ordering ordering = statement().findFirstEffectiveSubstatementArgument(OrderedByEffectiveStatement.class)
-            .orElse(Ordering.SYSTEM);
-        switch (ordering) {
-            case SYSTEM:
-                return isObject ? Types.setTypeWildcard() : Types.setTypeFor(type);
-            case USER:
-                return isObject ? Types.listTypeWildcard() : Types.listTypeFor(type);
-            default:
-                throw new IllegalStateException("Unexpected ordering " + ordering);
+
+        if (statement().ordering() == Ordering.SYSTEM) {
+            return isObject ? Types.setTypeWildcard() : Types.setTypeFor(type);
         }
+        return isObject ? Types.listTypeWildcard() : Types.listTypeFor(type);
     }
 
     @Override
-    LeafListRuntimeType createRuntimeType(final Type type) {
+    LeafListRuntimeType createExternalRuntimeType(final Type type) {
         return new DefaultLeafListRuntimeType(type, statement());
     }
 
     @Override
-    LeafListRuntimeType rebaseRuntimeType(final LeafListRuntimeType type, final LeafListEffectiveStatement statement) {
-        return new DefaultLeafListRuntimeType(type.javaType(), statement);
+    LeafListRuntimeType createInternalRuntimeType(final ChildLookup lookup, final LeafListEffectiveStatement statement,
+            final Type type) {
+        return new DefaultLeafListRuntimeType(type, statement);
     }
 }