public class Length extends Predicate
JSONArray
, the length of a JSONString
or the number of properties in a JSONObject
.
An example of a length validator. The JSONValue must be an array and it must have an exact length of 5.
{
"name" :"Array of length 5",
"type" :"and",
"rules" : [{"type":"array"}, {"type":"length","min":5,"max":5}]
}
public Length(String aName, JSONObject aRule) throws ValidationException
ValidationException
public void validate(JSONValue aValue) throws ValidationException
Validator
aValue
- The JSONValue that has to be validated.ValidationException
- If the validation fails.Copyright © 2012. All Rights Reserved.