Annotations that start with @ followed by an ID, and that are used on object attributes are validator annotations. The ID value must be the same as any validator that is defined in the application:
objectPerson
{
@FirstnameValidator("validr.msg.fname")
string fname;
@SurnameValidator("validr.msg.sname")
string sname;
}
validator
Used to declare a field validator
validator FirstnameValidator
{
minlen(2); maxlen(250);
}
validator AgeValidator
{
minval(0);
}
Atomic validators
These are the building blocks used for creating complex validators
notnull
Check that the attribute is not null. This validator does not take any arguments.
regex
Checks that the value conforms to a regular expression.
Add Comment