BUG-2606: add support for removing augmentations
authorRobert Varga <rovarga@cisco.com>
Mon, 19 Jan 2015 16:15:44 +0000 (17:15 +0100)
committerRobert Varga <rovarga@cisco.com>
Tue, 20 Jan 2015 10:20:06 +0000 (11:20 +0100)
This patch adds an explicit removeAugmentation() method to the builder.

Change-Id: I2111da008485512930dc2cfe551a787106c5f599
Signed-off-by: Robert Varga <rovarga@cisco.com>
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/BuilderTemplate.xtend

index 8f3f45fd326674c749932586cc1816ee419a3d68..3a53ad2a9396f602818caa90c049fa249230c43b 100644 (file)
@@ -455,10 +455,14 @@ class BuilderTemplate extends BaseTemplate {
 
             public «type.name»«BUILDER» add«augmentField.name.toFirstUpper»(«Class.importedName»<? extends «augmentField.returnType.importedName»> augmentationType, «augmentField.returnType.importedName» augmentation) {
                 if (augmentation == null) {
-                    this.«augmentField.name».remove(augmentationType);
-                } else {
-                    this.«augmentField.name».put(augmentationType, augmentation);
+                    return remove«augmentField.name.toFirstUpper»(augmentationType);
                 }
+                this.«augmentField.name».put(augmentationType, augmentation);
+                return this;
+            }
+
+            public «type.name»«BUILDER» remove«augmentField.name.toFirstUpper»(«Class.importedName»<? extends «augmentField.returnType.importedName»> augmentationType) {
+                this.«augmentField.name».remove(augmentationType);
                 return this;
             }
         «ENDIF»