Showing posts with label validation. Show all posts
Showing posts with label validation. Show all posts

Friday, May 04, 2007

Roma framework validation

Today I've successfull integrated the Validation Rules inside Roma Meta Framework.

(1) New annotation attribute to validate against RegExp rule:

Example:
public class Account{
...
@ViewField(match="^[_a-z0-9-]+(\\.?[_a-z0-9-]*)*@?[a-z0-9-]*(\\.?[a-z0-9-]*)*$")
private String email;
...
}


(2) Integrated the Informagen-Components Component library written by Will Gilbert.

Now Roma uses:

- IntegerTextField for int/Integer attributes
- NumericTextField for float/double/Float/Double attributes
- RegExpTextField for String attributes with "match" annotation (via Java5 annotation or Xml Annotation)

(3) New mean for min/max annotations

Now Roma uses:
- In String fields min/max are the minimum/maximum length
- In number fields min/max are the minimum/maximum value

Example:

public class Account{
...
@ViewField(min=3, max=32)
private String name;

@ViewField(min=18, max=130)
private String age;
...
}