Squash empty lists/maps
[mdsal.git] / binding / mdsal-binding-generator-api / src / main / java / org / opendaylight / mdsal / binding / model / api / GeneratedProperty.java
index 4a9ddb30bd2170fb1c200a44b9fea8411b788b39..011e7ad6121a1c29a0e6aa9dd78c2bcf8750f195 100644 (file)
@@ -8,23 +8,33 @@
 package org.opendaylight.mdsal.binding.model.api;
 
 /**
- * Generated Property extends interface {@link MethodSignature} interface. <br>
- * The Generated Property interface is designed to store information of fields
- * (or members) declared in Java Transfer Objects (or any java classes) and
- * their access counterparts (getters and setters).
+ * Generated Property extends {@link TypeMember} interface with additional information about fields (and other members)
+ * declared in Java Transfer Objects (or any java classes) and their access counterparts (getters and setters).
  *
- * @see MethodSignature
+ * @see TypeMember
  */
+// FIXME: 7.0.0: this interface (and others) need to be refactored:
+//               - getValue() is pretty much unused and its semantics are undefined
+//               - isReadOnly() is not related to getValue() and is not used together
+//               - nullifyEmpty() is applicable only to collection types and implies non-read-only and without value
+//               - this is misused by Builder spec :(
 public interface GeneratedProperty extends TypeMember {
 
     String getValue();
 
     /**
-     * Returns <code>true</code> if the property is declared as read-only. <br>
-     * If the property has flag <code>isReadOnly == true</code> the property
-     * SHOULD be generated as getter only.
+     * Returns <code>true</code> if the property is declared as read-only. If this {@code true} the property should be
+     * generated with only a getter.
      *
-     * @return <code>true</code> if the property is declared as read-only.
+     * @return {@code true<} if the property is declared as read-only.
      */
     boolean isReadOnly();
+
+    /**
+     * Returns indication whether the value should be squashed from empty collection to a null. This property is valid
+     * only if {@link #getReturnType()} results in a well-known collection type: List or Map.
+     *
+     * @return True if empty collections should be turned to nulls
+     */
+    boolean nullifyEmpty();
 }