org.hibernate.validator.ap.checks

## Class AbstractConstraintCheck

- java.lang.Object
- - org.hibernate.validator.ap.checks.AbstractConstraintCheck

- All Implemented Interfaces:
    ConstraintCheck
  Direct Known Subclasses:
    AnnotationTypeCheck, AnnotationTypeMemberCheck, ConstraintValidatorCheck, GetterCheck, GroupSequenceProviderCheck, PrimitiveCheck, RetentionPolicyCheck, StaticCheck, TargetCheck, TypeCheck

      public class AbstractConstraintCheck
      extends Object
      implements ConstraintCheck

  Abstract base class for `ConstraintCheck` implementations. Concrete checks should only override those check methods applicable for their supported element types.

  For instance would a check ensuring that constraint annotations are only given at non-static fields or methods only override `checkField()` and `checkMethod()`.

  All check methods not overridden will return an empty list.

  Author:
    Gunnar Morling

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractConstraintCheck()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<ConstraintCheckError>` | `checkAnnotationType(TypeElement element, AnnotationMirror annotation)` Checks, whether the given annotation is allowed at the given annotation type declaration.
    `Set<ConstraintCheckError>` | `checkField(VariableElement element, AnnotationMirror annotation)` Checks, whether the given annotation is allowed at the given field.
    `Set<ConstraintCheckError>` | `checkMethod(ExecutableElement element, AnnotationMirror annotation)` Checks, whether the given annotation is allowed at the given method.
    `Set<ConstraintCheckError>` | `checkNonAnnotationType(TypeElement element, AnnotationMirror annotation)` Checks, whether the given annotation is allowed at the given type declaration (class, interface, enum).

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractConstraintCheck

          public AbstractConstraintCheck()

  - ### Method Detail

    - #### checkField

          public Set<ConstraintCheckError> 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`
      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<ConstraintCheckError> 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`
      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<ConstraintCheckError> 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`
      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<ConstraintCheckError> 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`
      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.

Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved