|
From: Oliver H. <Ol...@ou...> - 2005-05-13 01:35:50
|
> Thanks for the pointer Oliver. I couldn't find the=20
> declarative part of Keith rules system in the sandbox but I=20
> guess it's a work in progress.
The Rules class is where you declare your validation. eg.
new Rules(Owner.class) {
protected void initRules() {
add("firstName", getNameValueConstraint());
add("lastName", getNameValueConstraint());
add(not(eqProperty("firstName", "lastName")));
add("address", required());
}
private Constraint getNameValueConstraint() {
return all(new Constraint[] { required(), maxLength(25),
regexp("[a-zA-Z]*", "alphabetic") });
}
};
This code is out the pet clinic sample app for SpringRich.
Ollie
|