public class Properties extends Predicate
JSONObject
to some tests.
Example
{
"name" :"Contact spec.",
"type" :"properties",
"pairs" : [{"key":"name", "optional":false, "rule":{"type":"string"}},
{"key":"country", "optional":false, "rule":{"type":"string"}},
{"key":"salary", "optional":true, "rule":{"type":"decimal"}}
]
}
Modifier and Type | Class and Description |
---|---|
static class |
Properties.PropRule |
Constructor and Description |
---|
Properties(String aName,
HashMap<String,Validator> aRuleset,
Properties.PropRule... rules) |
Properties(String aName,
JSONObject aRule,
HashMap<String,Validator> aRuleset) |
public Properties(String aName, HashMap<String,Validator> aRuleset, Properties.PropRule... rules)
public Properties(String aName, JSONObject aRule, HashMap<String,Validator> aRuleset) 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.