01: package nl.knowlogy.validation.annotations.beans;
02:
03: import nl.knowlogy.validation.annotations.ValidateAllowedValues;
04: import nl.knowlogy.validation.annotations.ValidateClass;
05: import nl.knowlogy.validation.annotations.ValidateIsNotBlank;
06: import nl.knowlogy.validation.annotations.ValidateMaxLength;
07: import nl.knowlogy.validation.annotations.ValidateMaxSize;
08: import nl.knowlogy.validation.annotations.ValidatePattern;
09:
10: @ValidateClass
11: public class Address {
12:
13: private String Street;
14: private Integer houseNumber;
15: private String houseNumberExtension;
16: private String zipCode;
17: private String City;
18:
19: @ValidateMaxLength(length=20)
20: @ValidateIsNotBlank(errorCode="street.isrequired")
21: public String getStreet() {
22: return Street;
23: }
24:
25: public void setStreet(String street) {
26: Street = street;
27: }
28:
29: @ValidateMaxSize(size=99,errorCode="housnumber.exceededmaxsize")
30: public Integer getHouseNumber() {
31: return houseNumber;
32: }
33:
34: public void setHouseNumber(Integer houseNumber) {
35: this .houseNumber = houseNumber;
36: }
37:
38: @ValidateAllowedValues(allowedValues="A,B")
39: public void setHouseNumberExtension(String houseNumberExtension) {
40: this .houseNumberExtension = houseNumberExtension;
41: }
42:
43: public String getHouseNumberExtension() {
44: return houseNumberExtension;
45: }
46:
47: public void setZipCode(String zipCode) {
48: this .zipCode = zipCode;
49: }
50:
51: @ValidatePattern(pattern="^[1-9]\\d{3}[- ]?[a-zA-Z]{2}$",errorCode="invalid.zipcode")
52: public String getZipCode() {
53: return zipCode;
54: }
55:
56: public void setCity(String city) {
57: City = city;
58: }
59:
60: public String getCity() {
61: return City;
62: }
63: }
|