Squash empty lists/maps
[mdsal.git] / binding / mdsal-binding-generator-util / src / main / java / org / opendaylight / mdsal / binding / model / util / generated / type / builder / GeneratedPropertyBuilderImpl.java
index 07e5492297d211a5ddf3448461a49444f1af6d93..5c9665e086a7269f4abb38a34b058d340c6e3c2c 100644 (file)
@@ -17,10 +17,12 @@ public final class GeneratedPropertyBuilderImpl extends AbstractTypeMemberBuilde
         implements GeneratedPropertyBuilder {
     private String value;
     private boolean readOnly;
+    private boolean nullifyEmpty;
 
     public GeneratedPropertyBuilderImpl(final String name) {
         super(name);
         this.readOnly = true;
+        this.nullifyEmpty = false;
     }
 
     @Override
@@ -35,6 +37,12 @@ public final class GeneratedPropertyBuilderImpl extends AbstractTypeMemberBuilde
         return this;
     }
 
+    @Override
+    public GeneratedPropertyBuilderImpl setNullifyEmpty(final boolean flag) {
+        this.nullifyEmpty = flag;
+        return this;
+    }
+
     @Override
     protected GeneratedPropertyBuilderImpl thisInstance() {
         return this;
@@ -44,7 +52,7 @@ public final class GeneratedPropertyBuilderImpl extends AbstractTypeMemberBuilde
     public GeneratedProperty toInstance(final Type definingType) {
         final List<AnnotationType> annotations = toAnnotationTypes();
         return new GeneratedPropertyImpl(definingType, getName(), annotations, getComment(), getAccessModifier(),
-                getReturnType(), isFinal(), isStatic(), this.readOnly, this.value);
+                getReturnType(), isFinal(), isStatic(), this.readOnly, this.nullifyEmpty, this.value);
     }
 
     @Override