01: package nl.knowlogy.validation.annotations.beans;
02:
03: import java.util.ArrayList;
04: import java.util.List;
05:
06: import nl.knowlogy.validation.annotations.ValidateClass;
07: import nl.knowlogy.validation.annotations.ValidateCustom;
08: import nl.knowlogy.validation.annotations.ValidateEmail;
09: import nl.knowlogy.validation.annotations.ValidateIsNotBlank;
10: import nl.knowlogy.validation.annotations.ValidateIsValid;
11: import nl.knowlogy.validation.annotations.ValidateMaxLength;
12:
13: @ValidateClass
14: public class Customer {
15:
16: private String firstName;
17: private String lastName;
18: private Address address;
19: private String creditCardNumber;
20: private String email;
21: private List<EmailSupport> emailAdresses = new ArrayList<EmailSupport>();
22:
23: @ValidateIsValid
24: public List<EmailSupport> getEmailAddresses() {
25: return emailAdresses;
26: }
27:
28: @ValidateIsNotBlank(errorCode="firstname.isrequired")
29: @ValidateMaxLength(length=20,errorCode="firstname.tolong")
30: public String getFirstName() {
31: return firstName;
32: }
33:
34: public void setFirstName(String firstName) {
35: this .firstName = firstName;
36: }
37:
38: @ValidateIsNotBlank
39: public String getLastName() {
40: return lastName;
41: }
42:
43: public void setLastName(String lastName) {
44: this .lastName = lastName;
45: }
46:
47: @ValidateIsValid
48: public Address getAddress() {
49: return address;
50: }
51:
52: public void setAddress(Address address) {
53: this .address = address;
54: }
55:
56: public void setCreditCardNumber(String creditCardNumber) {
57: this .creditCardNumber = creditCardNumber;
58: }
59:
60: @ValidateCustom(validatorClassName="nl.knowlogy.validation.customvalidators.CreditcardNumberValidator")
61: public String getCreditCardNumber() {
62: return creditCardNumber;
63: }
64:
65: @ValidateEmail
66: public String getEmail() {
67: return email;
68: }
69:
70: public void setEmail(String email) {
71: this.email = email;
72: }
73: }
|