Remove augmentableToAugmentations maps 23/47223/1
authorRobert Varga <rovarga@cisco.com>
Wed, 31 Aug 2016 15:25:52 +0000 (17:25 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 20 Oct 2016 20:54:25 +0000 (20:54 +0000)
These maps are not needed, hence we can forgo creating and maintaining
them.

Change-Id: Ib366bc3d61d8aca7a6f5f881b8a7c8db30ce8c85
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 082ccfc61766e06fb45c545780b53849f0c19771)

binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/BindingGeneratorImpl.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/ModuleContext.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/util/BindingRuntimeContext.java

index f604a7c9c6048c60488412512aba53a5440535fa..9e99a2ac40fdd3a5db54eefa50897b3eeb4c1941 100644 (file)
@@ -998,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);
 
         }
index aac2135c7d8d7023e32c1543c151027222e23c58..5ac14335f440767f93d4b1e89e5a14014c596b14 100644 (file)
@@ -34,23 +34,22 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 
 public final class ModuleContext {
     private GeneratedTypeBuilder moduleNode;
-    private final List<GeneratedTOBuilder> genTOs = new ArrayList<GeneratedTOBuilder>();
-    private final Map<SchemaPath, Type> typedefs = new HashMap<SchemaPath, Type>();
-    private final Map<SchemaPath, GeneratedTypeBuilder> childNodes = new HashMap<SchemaPath, GeneratedTypeBuilder>();
-    private final Map<SchemaPath, GeneratedTypeBuilder> groupings = new HashMap<SchemaPath, GeneratedTypeBuilder>();
-    private final Map<SchemaPath, GeneratedTypeBuilder> cases = new HashMap<SchemaPath, GeneratedTypeBuilder>();
+    private final List<GeneratedTOBuilder> genTOs = new ArrayList<>();
+    private final Map<SchemaPath, Type> typedefs = new HashMap<>();
+    private final Map<SchemaPath, GeneratedTypeBuilder> childNodes = new HashMap<>();
+    private final Map<SchemaPath, GeneratedTypeBuilder> groupings = new HashMap<>();
+    private final Map<SchemaPath, GeneratedTypeBuilder> cases = new HashMap<>();
     private final Map<QName,GeneratedTOBuilder> identities = new HashMap<>();
-    private final Set<GeneratedTypeBuilder> topLevelNodes = new HashSet<GeneratedTypeBuilder>();
-    private final List<GeneratedTypeBuilder> augmentations = new ArrayList<GeneratedTypeBuilder>();
-    private final BiMap<Type,AugmentationSchema> typeToAugmentation = HashBiMap.create();
+    private final Set<GeneratedTypeBuilder> topLevelNodes = new HashSet<>();
+    private final List<GeneratedTypeBuilder> augmentations = new ArrayList<>();
+    private final BiMap<Type, AugmentationSchema> typeToAugmentation = HashBiMap.create();
 
     private final Map<Type,Object> typeToSchema = new HashMap<>();
 
 
     private final Multimap<Type, Type> choiceToCases = HashMultimap.create();
-    private final BiMap<Type,ChoiceCaseNode> caseTypeToSchema = HashBiMap.create();
+    private final BiMap<Type, ChoiceCaseNode> caseTypeToSchema = HashBiMap.create();
 
-    private final Multimap<Type, Type> augmentableToAugmentations = HashMultimap.create();
     private final Map<SchemaPath, Type> innerTypes = new HashMap<>();
 
     List<Type> getGeneratedTypes() {
@@ -93,10 +92,6 @@ public final class ModuleContext {
         return Multimaps.unmodifiableMultimap(choiceToCases);
     }
 
-    public Multimap<Type, Type> getAugmentableToAugmentations() {
-        return Multimaps.unmodifiableMultimap(augmentableToAugmentations);
-    }
-
     public GeneratedTypeBuilder getModuleNode() {
         return moduleNode;
     }
@@ -183,12 +178,8 @@ public final class ModuleContext {
     }
 
     public void addTypeToAugmentation(final GeneratedTypeBuilder builder, final AugmentationSchema schema) {
-            typeToAugmentation.put(builder, schema);
-            typeToSchema.put(builder, schema);
-    }
-
-    public void addTargetToAugmentation(final Type target, final GeneratedTypeBuilder augmentation) {
-        augmentableToAugmentations.put(target,augmentation);
+        typeToAugmentation.put(builder, schema);
+        typeToSchema.put(builder, schema);
     }
 
     public void addChoiceToCaseMapping(final Type choiceType, final Type caseType, final ChoiceCaseNode schema) {
@@ -207,7 +198,7 @@ public final class ModuleContext {
      *
      * Valid values are only instances of {@link DataSchemaNode} or {@link AugmentationSchema}
      *
-     * @return
+     * @return Mapping from type to corresponding schema
      */
     public Map<Type, Object> getTypeToSchema() {
         return Collections.unmodifiableMap(typeToSchema);
index d1335f945a0558a6d1d636212705854092eeabd9..88fadd29ee97bd58aeda9fcc5344a808a6e706b7 100644 (file)
@@ -81,7 +81,6 @@ public class BindingRuntimeContext implements Immutable {
 
     private final Map<Type, AugmentationSchema> augmentationToSchema = new HashMap<>();
     private final BiMap<Type, Object> typeToDefiningSchema = HashBiMap.create();
-    private final Multimap<Type, Type> augmentableToAugmentations = HashMultimap.create();
     private final Multimap<Type, Type> choiceToCases = HashMultimap.create();
     private final Map<QName, Type> identities = new HashMap<>();
 
@@ -112,7 +111,6 @@ public class BindingRuntimeContext implements Immutable {
             typeToDefiningSchema.putAll(ctx.getTypeToSchema());
 
             ctx.getTypedefs();
-            augmentableToAugmentations.putAll(ctx.getAugmentableToAugmentations());
             choiceToCases.putAll(ctx.getChoiceToCases());
             identities.putAll(ctx.getIdentities());
         }