Class AbstractMethodOverrideCheck

java.lang.Object
org.hibernate.validator.ap.internal.classchecks.AbstractClassCheck
org.hibernate.validator.ap.internal.classchecks.AbstractMethodOverrideCheck
All Implemented Interfaces:
ClassCheck
Direct Known Subclasses:
ParametersMethodOverrideCheck, ReturnValueMethodOverrideCheck

public abstract class AbstractMethodOverrideCheck extends AbstractClassCheck
Abstract base class for ClassCheck implementations that check overridden methods.
Author:
Marko Bekhta, Guillaume Smet
  • Field Details

  • Constructor Details

  • Method Details

    • checkMethod

      public Set<ConstraintCheckIssue> checkMethod(ExecutableElement currentMethod)
      Description copied from interface: ClassCheck
      Checks whether the given method is written correctly.
      Specified by:
      checkMethod in interface ClassCheck
      Overrides:
      checkMethod in class AbstractClassCheck
      Parameters:
      currentMethod - the method under investigation
      Returns:
      a collection with errors that describe why the given method is not correctly implemented. In case no errors occur (the method is written correctly), an empty set must be returned
    • checkMethodInternal

      protected abstract Set<ConstraintCheckIssue> checkMethodInternal(ExecutableElement currentMethod, MethodInheritanceTree overriddenMethodsTree)
      Performs the check of a method.
      Parameters:
      currentMethod - a method to check
      overriddenMethodsTree - the MethodInheritanceTree of the method to check
      Returns:
      a set of issues if there are any, an empty set otherwise
    • needToPerformAnyChecks

      protected abstract boolean needToPerformAnyChecks(ExecutableElement currentMethod)
      There can be situations in which no checks should be performed. In such cases we will not perform any work at all.
      Parameters:
      currentMethod - the method under investigation
      Returns:
      true if we should proceed with checks and false otherwise
    • getEnclosingTypeElementQualifiedName

      protected String getEnclosingTypeElementQualifiedName(ExecutableElement currentMethod)
      Find a String representation of qualified name (Name) of corresponding TypeElement that contains a given ExecutableElement.
      Parameters:
      currentMethod - a method
      Returns:
      a class/interface qualified name represented by String to which a method belongs to