Remove augmentableToAugmentations maps
[mdsal.git] / binding / mdsal-binding-generator-impl / src / main / java / org / opendaylight / yangtools / sal / binding / generator / impl / BindingGeneratorImpl.java
index 74acf2d529b85678608a730b5cb6a3835c531fc1..9e99a2ac40fdd3a5db54eefa50897b3eeb4c1941 100644 (file)
@@ -103,10 +103,8 @@ import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
 import org.opendaylight.yangtools.yang.model.util.DataNodeIterator;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
 import org.opendaylight.yangtools.yang.model.util.SchemaNodeUtils;
-import org.opendaylight.yangtools.yang.model.util.UnionType;
 import org.opendaylight.yangtools.yang.model.util.type.CompatUtils;
 import org.opendaylight.yangtools.yang.parser.util.ModuleDependencySort;
 import org.slf4j.Logger;
@@ -914,10 +912,9 @@ public class BindingGeneratorImpl implements BindingGenerator {
         final GroupingDefinition grouping = (GroupingDefinition) targetGrouping;
         SchemaNode result = grouping;
         for (final QName node : targetPath.getPathFromRoot()) {
-            // finding by local name is valid, grouping cannot contain nodes
-            // with same name and different namespace
             if (result instanceof DataNodeContainer) {
-                result = ((DataNodeContainer) result).getDataChildByName(node.getLocalName());
+                final QName resultNode = QName.create(result.getQName().getModule(), node.getLocalName());
+                result = ((DataNodeContainer) result).getDataChildByName(resultNode);
             } else if (result instanceof ChoiceSchemaNode) {
                 result = ((ChoiceSchemaNode) result).getCaseNodeByName(node.getLocalName());
             }
@@ -1001,8 +998,7 @@ public class BindingGeneratorImpl implements BindingGenerator {
         augSchemaNodeToMethods(module, basePackageName, augTypeBuilder, augTypeBuilder, augSchema.getChildNodes());
         augmentBuilders.put(augTypeName, augTypeBuilder);
 
-        if(!augSchema.getChildNodes().isEmpty()) {
-            genCtx.get(module).addTargetToAugmentation(targetTypeRef, augTypeBuilder);
+        if (!augSchema.getChildNodes().isEmpty()) {
             genCtx.get(module).addTypeToAugmentation(augTypeBuilder, augSchema);
 
         }
@@ -1372,11 +1368,6 @@ public class BindingGeneratorImpl implements BindingGenerator {
     }
 
     private static boolean isInnerType(final LeafSchemaNode leaf, final TypeDefinition<?> type) {
-        // Deal with old parser, clearing out references to typedefs
-        if (type instanceof ExtendedType) {
-            return false;
-        }
-
         // New parser with encapsulated type
         if (leaf.getPath().equals(type.getPath())) {
             return true;
@@ -1387,11 +1378,6 @@ public class BindingGeneratorImpl implements BindingGenerator {
             return true;
         }
 
-        // Old parser uses broken Union type, which does not change its schema path
-        if (type instanceof UnionType) {
-            return true;
-        }
-
         return false;
     }
 
@@ -1478,10 +1464,6 @@ public class BindingGeneratorImpl implements BindingGenerator {
     }
 
     private static TypeDefinition<?> getBaseOrDeclaredType(final TypeDefinition<?> typeDef) {
-        if (typeDef instanceof ExtendedType) {
-            // Legacy behaviour returning ExtendedType is enough
-            return typeDef;
-        }
         // Returns DerivedType in case of new parser.
         final TypeDefinition<?> baseType = typeDef.getBaseType();
         return (baseType != null && baseType.getBaseType() != null) ? baseType : typeDef;
@@ -2023,10 +2005,8 @@ public class BindingGeneratorImpl implements BindingGenerator {
 
     /**
      * Builds generated TO builders for <code>typeDef</code> of type
-     * {@link org.opendaylight.yangtools.yang.model.util.UnionType UnionType} or
-     * {@link org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition
-     * BitsTypeDefinition} which are also added to <code>typeBuilder</code> as
-     * enclosing transfer object.
+     * {@link UnionTypeDefinition} or {@link BitsTypeDefinition} which are
+     * also added to <code>typeBuilder</code> as enclosing transfer object.
      *
      * If more then one generated TO builder is created for enclosing then all
      * of the generated TO builders are added to <code>typeBuilder</code> as
@@ -2289,4 +2269,4 @@ public class BindingGeneratorImpl implements BindingGenerator {
             builder.addAnnotation("", "Deprecated");
         }
     }
-}
\ No newline at end of file
+}