[ONOS-6874] Implement nullable ConsistentMap
Change-Id: I82a232d376b230b06977b24f12364aa374c9c113
diff --git a/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java b/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java
index ae97660..d991072 100644
--- a/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java
@@ -26,6 +26,7 @@
public abstract class ConsistentMapBuilder<K, V>
extends DistributedPrimitiveBuilder<ConsistentMapBuilder<K, V>, ConsistentMap<K, V>> {
+ private boolean nullValues = false;
private boolean purgeOnUninstall = false;
public ConsistentMapBuilder() {
@@ -33,6 +34,16 @@
}
/**
+ * Enables null values in the map.
+ *
+ * @return this builder
+ */
+ public ConsistentMapBuilder<K, V> withNullValues() {
+ nullValues = true;
+ return this;
+ }
+
+ /**
* Clears map contents when the owning application is uninstalled.
*
* @return this builder
@@ -43,6 +54,15 @@
}
/**
+ * Returns whether null values are supported by the map.
+ *
+ * @return {@code true} if null values are supported; {@code false} otherwise
+ */
+ public boolean nullValues() {
+ return nullValues;
+ }
+
+ /**
* Returns if map entries need to be cleared when owning application is uninstalled.
* @return {@code true} if yes; {@code false} otherwise.
*/