Using this expression syntax will make it very complex. The way I have always done this in the past is to have an abstract class of rules from which I get specific types of rules. Then I add them to the validator:
Validator v;
v.add( new NotValueRule( "foo" ) );
v.add( new NotIntRule ) );
v.add( new BetweenRule( "a", "z" ) );
and then call the validate () function on the validator. This does not allow directly for ands and ors, but you can get around this with a few "fake" rules called AndRule and OrRule.
anon
source
share