Code generator prototype - Binding specification v2
[mdsal.git] / binding2 / mdsal-binding2-java-api-generator / src / main / java / org / opendaylight / mdsal / binding / javav2 / java / api / generator / renderers / BuilderRenderer.java
index 9e6afb35626469d2ac34214c82cc59fed175d5c4..53a7b94899aa1523160519d2b88b989dc1e5318e 100644 (file)
@@ -240,6 +240,7 @@ public class BuilderRenderer extends BaseRenderer {
 
     @Override
     protected String body() {
+        String parentTypeForBuilderName;
         importedNames.put("genType", importedName(getType()));
         importedNames.put("objects", importedName(Objects.class));
         importedNames.put("object", importedName(Object.class));
@@ -250,8 +251,10 @@ public class BuilderRenderer extends BaseRenderer {
         importedNames.put("item", importedName(Item.class));
         if (getType().getParentType() != null) {
             importedNames.put("parent", importedName(getType().getParentType()));
+            parentTypeForBuilderName = getType().getParentType().getName();
         } else {
-            //TODO implement - get module as type
+            importedNames.put("parentTypeForBuilder", importedName(getType().getParentTypeForBuilder()));
+            parentTypeForBuilderName = getType().getParentTypeForBuilder().getName();
         }
         importedNames.put("augmentation", importedName(Augmentation.class));
         importedNames.put("classInstMap", importedName(ClassToInstanceMap.class));
@@ -261,7 +264,7 @@ public class BuilderRenderer extends BaseRenderer {
         List<String> getterMethods = new ArrayList<>(Collections2.transform(properties, this::getterMethod));
 
         return builderTemplate.render(getType(), properties, importedNames, importedNamesForProperties, augmentField,
-                copyConstructorHelper, getterMethods)
+                copyConstructorHelper, getterMethods, parentTypeForBuilderName)
                 .body();
     }