1 package ejava.jpa.example.validation;
2
3 import java.lang.annotation.Documented;
4 import java.lang.annotation.Retention;
5
6 import java.lang.annotation.Target;
7 import static java.lang.annotation.ElementType.*;
8 import static java.lang.annotation.RetentionPolicy.*;
9 import javax.validation.Constraint;
10 import javax.validation.Payload;
11
12
13
14
15
16 @Documented
17 @Constraint(validatedBy={CityStateOrZipValidator.class})
18 @Target({TYPE, ANNOTATION_TYPE})
19 @Retention(RUNTIME)
20 public @interface CityStateOrZip {
21 String message() default "must have city and state or zip code";
22 Class<?>[] groups() default {};
23 Class<? extends Payload>[] payload() default{};
24
25
26
27
28 @Target({TYPE, ANNOTATION_TYPE})
29 @Retention(RUNTIME)
30 @Documented
31 public @interface List {
32 CityStateOrZip[] value();
33 }
34 }