isBoolean addition
Change-Id: I83d428702314e6cd81f35b8bbbd04eed597cc04d
diff --git a/core/api/src/main/java/org/onosproject/net/config/Config.java b/core/api/src/main/java/org/onosproject/net/config/Config.java
index 5f2c9f3..0a3d87f 100644
--- a/core/api/src/main/java/org/onosproject/net/config/Config.java
+++ b/core/api/src/main/java/org/onosproject/net/config/Config.java
@@ -459,6 +459,19 @@
}
/**
+ * Indicates whether the specified field holds a valid boolean value.
+ *
+ * @param field JSON field name
+ * @param presence specifies if field is optional or mandatory
+ * @return true if valid; false otherwise
+ * @throws IllegalArgumentException if field is present, but not valid
+ */
+ protected boolean isBoolean(String field, FieldPresence presence) {
+ JsonNode node = object.path(field);
+ return isValid(node, presence, node.isBoolean());
+ }
+
+ /**
* Indicates whether the node is present and of correct value or not
* mandatory and absent.
*
@@ -471,5 +484,4 @@
boolean isMandatory = presence == FieldPresence.MANDATORY;
return isMandatory && correctValue || !isMandatory && !node.isNull() || correctValue;
}
-
}