Skip to content

Commit

Permalink
HV-1631 Avoid doing two lookups in the read methods of AnnotationProc…
Browse files Browse the repository at this point in the history
…essingOptionsImpl
  • Loading branch information
gsmet committed Jun 11, 2018
1 parent c0bc36a commit 20a8b1b
Showing 1 changed file with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ public class AnnotationProcessingOptionsImpl implements AnnotationProcessingOpti
@Override
public boolean areMemberConstraintsIgnoredFor(Constrainable constrainable) {
Class<?> clazz = constrainable.getDeclaringClass();
if ( annotationIgnoredForMembers.containsKey( constrainable ) ) {
return annotationIgnoredForMembers.get( constrainable );
Boolean annotationIgnoredForMember = annotationIgnoredForMembers.get( constrainable );
if ( annotationIgnoredForMember != null ) {
return annotationIgnoredForMember;
}
else {
return areAllConstraintAnnotationsIgnoredFor( clazz );
Expand All @@ -70,8 +71,9 @@ public boolean areMemberConstraintsIgnoredFor(Constrainable constrainable) {

@Override
public boolean areReturnValueConstraintsIgnoredFor(Constrainable constrainable) {
if ( annotationIgnoresForReturnValues.containsKey( constrainable ) ) {
return annotationIgnoresForReturnValues.get( constrainable );
Boolean annotationIgnoreForReturnValue = annotationIgnoresForReturnValues.get( constrainable );
if ( annotationIgnoreForReturnValue != null ) {
return annotationIgnoreForReturnValue;
}
else {
return areMemberConstraintsIgnoredFor( constrainable );
Expand All @@ -80,8 +82,9 @@ public boolean areReturnValueConstraintsIgnoredFor(Constrainable constrainable)

@Override
public boolean areCrossParameterConstraintsIgnoredFor(Constrainable constrainable) {
if ( annotationIgnoresForCrossParameter.containsKey( constrainable ) ) {
return annotationIgnoresForCrossParameter.get( constrainable );
Boolean annotationIgnoreForCrossParameter = annotationIgnoresForCrossParameter.get( constrainable );
if ( annotationIgnoreForCrossParameter != null ) {
return annotationIgnoreForCrossParameter;
}
else {
return areMemberConstraintsIgnoredFor( constrainable );
Expand All @@ -91,8 +94,9 @@ public boolean areCrossParameterConstraintsIgnoredFor(Constrainable constrainabl
@Override
public boolean areParameterConstraintsIgnoredFor(Constrainable constrainable, int index) {
ExecutableParameterKey key = new ExecutableParameterKey( constrainable, index );
if ( annotationIgnoresForMethodParameter.containsKey( key ) ) {
return annotationIgnoresForMethodParameter.get( key );
Boolean annotationIgnoreForMethodParameter = annotationIgnoresForMethodParameter.get( key );
if ( annotationIgnoreForMethodParameter != null ) {
return annotationIgnoreForMethodParameter;
}
else {
return areMemberConstraintsIgnoredFor( constrainable );
Expand All @@ -102,8 +106,9 @@ public boolean areParameterConstraintsIgnoredFor(Constrainable constrainable, in
@Override
public boolean areClassLevelConstraintsIgnoredFor(Class<?> clazz) {
boolean ignoreAnnotation;
if ( annotationIgnoresForClasses.containsKey( clazz ) ) {
ignoreAnnotation = annotationIgnoresForClasses.get( clazz );
Boolean annotationIgnoreForClass = annotationIgnoresForClasses.get( clazz );
if ( annotationIgnoreForClass != null ) {
ignoreAnnotation = annotationIgnoreForClass;
}
else {
ignoreAnnotation = areAllConstraintAnnotationsIgnoredFor( clazz );
Expand Down

0 comments on commit 20a8b1b

Please sign in to comment.