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

public abstract class AnnotationParametersAbstractCheck extends AbstractConstraintCheck
Checks that parameters used on annotation are valid.
Author:
Marko Bekhta
  • Field Details

  • Constructor Details

    • AnnotationParametersAbstractCheck

      public AnnotationParametersAbstractCheck(AnnotationApiHelper annotationApiHelper, String... annotationClass)
  • Method Details

    • checkField

      public Set<ConstraintCheckIssue> checkField(VariableElement element, AnnotationMirror annotation)
      Description copied from interface: ConstraintCheck
      Checks, whether the given annotation is allowed at the given field.
      Specified by:
      checkField in interface ConstraintCheck
      Overrides:
      checkField in class AbstractConstraintCheck
      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 interface ConstraintCheck
      Overrides:
      checkMethod in class AbstractConstraintCheck
      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 interface ConstraintCheck
      Overrides:
      checkAnnotationType in class AbstractConstraintCheck
      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 interface ConstraintCheck
      Overrides:
      checkNonAnnotationType in class AbstractConstraintCheck
      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

      protected boolean canCheckThisAnnotation(AnnotationMirror annotation)
      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

      protected abstract Set<ConstraintCheckIssue> doCheck(Element element, AnnotationMirror annotation)
      Method which actually performs the validation of the annotation parameters.
      Parameters:
      element - annotated element
      annotation - annotation to process
      Returns:
      a set of ConstraintCheckIssue errors if there are any validation issues with the annotation parameters