Class AnnotationParametersAbstractCheck
java.lang.Object
org.hibernate.validator.ap.internal.checks.AbstractConstraintCheck
org.hibernate.validator.ap.internal.checks.annotationparameters.AnnotationParametersAbstractCheck
- All Implemented Interfaces:
ConstraintCheck
- Direct Known Subclasses:
AnnotationMessageCheck
,AnnotationParametersDecimalMinMaxCheck
,AnnotationParametersDigitsCheck
,AnnotationParametersGroupsCheck
,AnnotationParametersPatternCheck
,AnnotationParametersScriptAssertCheck
,AnnotationParametersSizeLengthCheck
,AnnotationPayloadUnwrappingCheck
,GroupSequenceCheck
Checks that parameters used on annotation are valid.
- Author:
- Marko Bekhta
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAnnotationParametersAbstractCheck
(AnnotationApiHelper annotationApiHelper, String... annotationClass) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
canCheckThisAnnotation
(AnnotationMirror annotation) Verify that this check class can process such annotation.checkAnnotationType
(TypeElement element, AnnotationMirror annotation) Checks, whether the given annotation is allowed at the given annotation type declaration.checkField
(VariableElement element, AnnotationMirror annotation) Checks, whether the given annotation is allowed at the given field.checkMethod
(ExecutableElement element, AnnotationMirror annotation) Checks, whether the given annotation is allowed at the given method.checkNonAnnotationType
(TypeElement element, AnnotationMirror annotation) Checks, whether the given annotation is allowed at the given type declaration (class, interface, enum).protected abstract Set<ConstraintCheckIssue>
doCheck
(Element element, AnnotationMirror annotation) Method which actually performs the validation of the annotation parameters.
-
Field Details
-
annotationApiHelper
-
-
Constructor Details
-
AnnotationParametersAbstractCheck
public AnnotationParametersAbstractCheck(AnnotationApiHelper annotationApiHelper, String... annotationClass)
-
-
Method Details
-
checkField
Description copied from interface:ConstraintCheck
Checks, whether the given annotation is allowed at the given field.- Specified by:
checkField
in interfaceConstraintCheck
- Overrides:
checkField
in classAbstractConstraintCheck
- Parameters:
element
- An annotated field.annotation
- An annotation at that field.- Returns:
- A set with errors, that describe, why the given annotation is not allowed at the given element. In case no errors occur (the given annotation is allowed at the given element), an empty set must be returned.
-
checkMethod
public Set<ConstraintCheckIssue> checkMethod(ExecutableElement element, AnnotationMirror annotation) Description copied from interface:ConstraintCheck
Checks, whether the given annotation is allowed at the given method.- Specified by:
checkMethod
in interfaceConstraintCheck
- Overrides:
checkMethod
in classAbstractConstraintCheck
- Parameters:
element
- An annotated method.annotation
- An annotation at that method.- Returns:
- A set with errors, that describe, why the given annotation is not allowed at the given element. In case no errors occur (the given annotation is allowed at the given element), an empty set must be returned.
-
checkAnnotationType
public Set<ConstraintCheckIssue> checkAnnotationType(TypeElement element, AnnotationMirror annotation) Description copied from interface:ConstraintCheck
Checks, whether the given annotation is allowed at the given annotation type declaration.- Specified by:
checkAnnotationType
in interfaceConstraintCheck
- Overrides:
checkAnnotationType
in classAbstractConstraintCheck
- Parameters:
element
- An annotated annotation type declaration.annotation
- An annotation at that annotation type.- Returns:
- A set with errors, that describe, why the given annotation is not allowed at the given element. In case no errors occur (the given annotation is allowed at the given element), an empty set must be returned.
-
checkNonAnnotationType
public Set<ConstraintCheckIssue> checkNonAnnotationType(TypeElement element, AnnotationMirror annotation) Description copied from interface:ConstraintCheck
Checks, whether the given annotation is allowed at the given type declaration (class, interface, enum).- Specified by:
checkNonAnnotationType
in interfaceConstraintCheck
- Overrides:
checkNonAnnotationType
in classAbstractConstraintCheck
- Parameters:
element
- An annotated type declaration.annotation
- An annotation at that type.- Returns:
- A set with errors, that describe, why the given annotation is not allowed at the given element. In case no errors occur (the given annotation is allowed at the given element), an empty set must be returned.
-
canCheckThisAnnotation
Verify that this check class can process such annotation.- Parameters:
annotation
- annotation you want to process by this class- Returns:
true
if such annotation can be processed,false
otherwise.
-
doCheck
Method which actually performs the validation of the annotation parameters.- Parameters:
element
- annotated elementannotation
- annotation to process- Returns:
- a set of
ConstraintCheckIssue
errors if there are any validation issues with the annotation parameters
-