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 @Documented
16 @Constraint(validatedBy={MinAgeValidator.class})
17 @Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
18 @Retention(RUNTIME)
19 public @interface MinAge {
20 String message() default "too young";
21 Class<?>[] groups() default {};
22 Class<? extends Payload>[] payload() default{};
23 int age();
24
25
26
27
28 @Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
29 @Retention(RUNTIME)
30 @Documented
31 public @interface List {
32 MinAge[] value();
33 }
34 }