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
Abstract base class for
ClassCheck implementations that check overridden methods.- Author:
- Marko Bekhta, Guillaume Smet
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractMethodOverrideCheck(Elements elementUtils, Types typeUtils, ConstraintHelper constraintHelper) -
Method Summary
Modifier and TypeMethodDescriptioncheckMethod(ExecutableElement currentMethod) Checks whether the given method is written correctly.protected abstract Set<ConstraintCheckIssue>checkMethodInternal(ExecutableElement currentMethod, MethodInheritanceTree overriddenMethodsTree) Performs the check of a method.protected StringgetEnclosingTypeElementQualifiedName(ExecutableElement currentMethod) Find aStringrepresentation of qualified name (Name) of correspondingTypeElementthat contains a givenExecutableElement.protected abstract booleanneedToPerformAnyChecks(ExecutableElement currentMethod) There can be situations in which no checks should be performed.Methods inherited from class org.hibernate.validator.ap.internal.classchecks.AbstractClassCheck
execute
-
Field Details
-
constraintHelper
-
-
Constructor Details
-
AbstractMethodOverrideCheck
public AbstractMethodOverrideCheck(Elements elementUtils, Types typeUtils, ConstraintHelper constraintHelper)
-
-
Method Details
-
checkMethod
Description copied from interface:ClassCheckChecks whether the given method is written correctly.- Specified by:
checkMethodin interfaceClassCheck- Overrides:
checkMethodin classAbstractClassCheck- 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 checkoverriddenMethodsTree- theMethodInheritanceTreeof the method to check- Returns:
- a set of issues if there are any, an empty set otherwise
-
needToPerformAnyChecks
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:
trueif we should proceed with checks andfalseotherwise
-
getEnclosingTypeElementQualifiedName
Find aStringrepresentation of qualified name (Name) of correspondingTypeElementthat contains a givenExecutableElement.- Parameters:
currentMethod- a method- Returns:
- a class/interface qualified name represented by
Stringto which a method belongs to
-