Code generator prototype - Binding specification v2 35/56035/1
authorMartin Ciglan <mciglan@cisco.com>
Tue, 25 Apr 2017 11:04:09 +0000 (13:04 +0200)
committerMartin Ciglan <mciglan@cisco.com>
Wed, 26 Apr 2017 06:14:12 +0000 (06:14 +0000)
- fixes compilability issues in class template
for constructors

Change-Id: Ib55533f6dc8948b2ca23c395e19b5a6ed30d4b76
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
(cherry picked from commit 063ba2e5851072e07f7aca80c69b25ebc6a0ed54)

binding2/mdsal-binding2-java-api-generator/src/main/twirl/org/opendaylight/mdsal/binding/javav2/java/api/generator/classTemplateConstructors.scala.txt

index 2fffb72307ea630be5df6b2614f22d83ce02f810..fc9aed44d52644bc1ce69423da089d9ba65cf27c 100644 (file)
 @(genTo: GeneratedTransferObject, allProperties: List[GeneratedProperty], properties: List[GeneratedProperty],
 parentProperties: List[GeneratedProperty], importedNames: Map[String, String], argumentsDeclaration: String,
 unionConstructor: String, genRestrictions: String)
-@if(unionConstructor != null) {
+@if(!unionConstructor.isEmpty) {
 @{unionConstructor}
 } else {
     @if(genTo.isTypedef && !allProperties.isEmpty && allProperties.size == 1 && allProperties.get(0).getName.equals("value")) {
-        @@@{importedNames.get("constructorProperties")}("value")
+    @@@{importedNames.get("constructorProperties")}("value")
     }
     public @{genTo.getName}(@{argumentsDeclaration}) {
         @if(!parentProperties.isEmpty) {
@@ -46,7 +46,7 @@ unionConstructor: String, genRestrictions: String)
                     this.@{fieldName(prop)} = @{fieldName(prop)} == null ? null : @{fieldName(prop)}.clone();
                 }
             } else {
-                this.@{fieldName(prop)} = this.@{fieldName(prop)};
+                this.@{fieldName(prop)} = @{fieldName(prop)};
             }
         }
     }