Thejaswi NK
Committed by Gerrit Code Review

isBoolean addition

Change-Id: I83d428702314e6cd81f35b8bbbd04eed597cc04d
......@@ -459,6 +459,19 @@ public abstract class Config<S> {
}
/**
* 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 @@ public abstract class Config<S> {
boolean isMandatory = presence == FieldPresence.MANDATORY;
return isMandatory && correctValue || !isMandatory && !node.isNull() || correctValue;
}
}
......