public class Let extends Predicate
In this example we create a rule that matches a's or b's but not a mix of the two. In order to make the definition of our predicate a bit easier we make use of named sub rules.
{
"name" :"Let test - a's or b's",
"type" :"let",
"*" : "start",
"rules" : [{"name":"start", "type":"or", "rules":[{"type":"ref", "*":"a"}, {"type":"ref", "*":"b"}]},
{"name":"a", "type":"regexp", "pattern":"a*"},
{"name":"b", "type":"regexp", "pattern":"b*"}
]
}
public Let(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.