01: package demo.continuations;
02:
03: import com.uwyn.rife.site.ConstrainedBean;
04: import com.uwyn.rife.site.ConstrainedProperty;
05: import com.uwyn.rife.site.MetaData;
06:
07: public class OrderDataMetaData extends
08: MetaData<ConstrainedBean, ConstrainedProperty> {
09: public final static String GROUP_SHIPPING = "shipping";
10: public final static String GROUP_CREDITCARD = "creditcard";
11:
12: public void activateMetaData() {
13: addGroup(GROUP_SHIPPING)
14: .addConstraint(
15: new ConstrainedProperty("shippingMethod")
16: .notNull(true));
17:
18: addGroup(GROUP_CREDITCARD)
19: .addConstraint(
20: new ConstrainedProperty("creditCardType")
21: .notNull(true)).addConstraint(
22: new ConstrainedProperty("creditCardNumber")
23: .notNull(true).minLength(16).maxLength(
24: 16).regexp("\\d+"))
25: .addConstraint(
26: new ConstrainedProperty("creditCardExpiration")
27: .notNull(true).maxLength(5).regexp(
28: "\\d{2}/\\d{2}"));
29: }
30: }
|