/
AbstractConstraintCheck.java
56 lines (46 loc) · 1.64 KB
/
AbstractConstraintCheck.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Hibernate Validator, declare and validate application constraints
*
* License: Apache License, Version 2.0
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
*/
package org.hibernate.validator.ap.checks;
import java.util.Collections;
import java.util.Set;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
/**
* <p>
* Abstract base class for {@link ConstraintCheck} implementations. Concrete
* checks should only override those check methods applicable for their
* supported element types.
* </p>
* <p>
* For instance would a check ensuring that constraint annotations are only
* given at non-static fields or methods only override <code>checkField()</code>
* and <code>checkMethod()</code>.
* </p>
* <p>
* All check methods not overridden will return an empty list.
* </p>
*
* @author Gunnar Morling
*/
public class AbstractConstraintCheck implements ConstraintCheck {
public Set<ConstraintCheckError> checkField(VariableElement element, AnnotationMirror annotation) {
return Collections.emptySet();
}
public Set<ConstraintCheckError> checkMethod(ExecutableElement element, AnnotationMirror annotation) {
return Collections.emptySet();
}
public Set<ConstraintCheckError> checkAnnotationType(TypeElement element,
AnnotationMirror annotation) {
return Collections.emptySet();
}
public Set<ConstraintCheckError> checkNonAnnotationType(
TypeElement element, AnnotationMirror annotation) {
return Collections.emptySet();
}
}