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
-
Constructor Summary
ConstructorDescriptionAbstractMethodOverrideCheck
(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 String
getEnclosingTypeElementQualifiedName
(ExecutableElement currentMethod) Find aString
representation of qualified name (Name
) of correspondingTypeElement
that contains a givenExecutableElement
.protected abstract boolean
needToPerformAnyChecks
(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:ClassCheck
Checks whether the given method is written correctly.- Specified by:
checkMethod
in interfaceClassCheck
- Overrides:
checkMethod
in 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
- theMethodInheritanceTree
of 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:
true
if we should proceed with checks andfalse
otherwise
-
getEnclosingTypeElementQualifiedName
Find aString
representation of qualified name (Name
) of correspondingTypeElement
that contains a givenExecutableElement
.- Parameters:
currentMethod
- a method- Returns:
- a class/interface qualified name represented by
String
to which a method belongs to
-