1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package de.smartics.validation.constraints;
17
18 import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
19 import static java.lang.annotation.ElementType.FIELD;
20 import static java.lang.annotation.ElementType.METHOD;
21 import static java.lang.annotation.RetentionPolicy.RUNTIME;
22
23 import java.lang.annotation.Documented;
24 import java.lang.annotation.Retention;
25 import java.lang.annotation.Target;
26
27 import javax.validation.Constraint;
28 import javax.validation.Payload;
29
30 import de.smartics.validation.constraints.impl.InetAdressAvailabilityValidator;
31 import de.smartics.validation.constraints.impl.MailServerAvailabilityValidator;
32 import de.smartics.validation.constraints.impl.UriAvailabilityValidator;
33 import de.smartics.validation.constraints.impl.UrlAvailabilityValidator;
34
35
36
37
38 @Target({ METHOD, FIELD, ANNOTATION_TYPE })
39 @Retention(RUNTIME)
40 @Documented
41 @Constraint(validatedBy = { UriAvailabilityValidator.class,
42 UrlAvailabilityValidator.class,
43 InetAdressAvailabilityValidator.class,
44 MailServerAvailabilityValidator.class })
45 public @interface Available
46 {
47
48
49
50
51
52
53
54
55 String MESSAGE_KEY = "{de.smartics.validation.constraints.Available.message}";
56
57
58
59
60 int ONE_SECOND = 1000;
61
62
63
64
65
66
67 String value() default "200";
68
69
70
71
72 int timeout() default ONE_SECOND;
73
74
75
76
77
78
79
80
81 String message() default MESSAGE_KEY;
82
83
84
85
86 Class<?>[] groups() default {};
87
88
89
90
91 Class<? extends Payload>[] payload() default {};
92
93 }