Move address-bindings config to new config system
Change-Id: I6d87ddbf98789dbe8355c453a3263f50fbc5d99c
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/config/Config.java b/incubator/api/src/main/java/org/onosproject/incubator/net/config/Config.java
index 12f3114..2be2fba 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/config/Config.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/config/Config.java
@@ -151,6 +151,33 @@
}
/**
+ * Gets the specified property as an integer.
+ *
+ * @param name property name
+ * @param defaultValue default value if property not set
+ * @return property value or default value
+ */
+ protected int get(String name, int defaultValue) {
+ return node.path(name).asInt(defaultValue);
+ }
+
+ /**
+ * Sets the specified property as an integer or clears it if null value given.
+ *
+ * @param name property name
+ * @param value new value or null to clear the property
+ * @return self
+ */
+ protected Config<S> setOrClear(String name, Integer value) {
+ if (value != null) {
+ node.put(name, value.intValue());
+ } else {
+ node.remove(name);
+ }
+ return this;
+ }
+
+ /**
* Gets the specified property as a long.
*
* @param name property name
@@ -231,4 +258,5 @@
}
return this;
}
+
}