Consistent equals implementations in AOP support classes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -196,14 +196,9 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof AbstractRegexpMethodPointcut otherPointcut)) {
|
||||
return false;
|
||||
}
|
||||
return (Arrays.equals(this.patterns, otherPointcut.patterns) &&
|
||||
Arrays.equals(this.excludedPatterns, otherPointcut.excludedPatterns));
|
||||
return (this == other || (other instanceof AbstractRegexpMethodPointcut otherPointcut &&
|
||||
Arrays.equals(this.patterns, otherPointcut.patterns) &&
|
||||
Arrays.equals(this.excludedPatterns, otherPointcut.excludedPatterns)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -187,14 +187,9 @@ public class ComposablePointcut implements Pointcut, Serializable {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof ComposablePointcut otherPointcut)) {
|
||||
return false;
|
||||
}
|
||||
return (this.classFilter.equals(otherPointcut.classFilter) &&
|
||||
this.methodMatcher.equals(otherPointcut.methodMatcher));
|
||||
return (this == other || (other instanceof ComposablePointcut otherPointcut &&
|
||||
this.classFilter.equals(otherPointcut.classFilter) &&
|
||||
this.methodMatcher.equals(otherPointcut.methodMatcher)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -125,13 +125,9 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof ControlFlowPointcut that)) {
|
||||
return false;
|
||||
}
|
||||
return (this.clazz.equals(that.clazz)) && ObjectUtils.nullSafeEquals(this.methodName, that.methodName);
|
||||
return (this == other || (other instanceof ControlFlowPointcut that &&
|
||||
this.clazz.equals(that.clazz)) &&
|
||||
ObjectUtils.nullSafeEquals(this.methodName, that.methodName));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -143,13 +143,8 @@ public abstract class MethodMatchers {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof UnionMethodMatcher that)) {
|
||||
return false;
|
||||
}
|
||||
return (this.mm1.equals(that.mm1) && this.mm2.equals(that.mm2));
|
||||
return (this == other || (other instanceof UnionMethodMatcher that &&
|
||||
this.mm1.equals(that.mm1) && this.mm2.equals(that.mm2)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -307,13 +302,8 @@ public abstract class MethodMatchers {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof IntersectionMethodMatcher that)) {
|
||||
return false;
|
||||
}
|
||||
return (this.mm1.equals(that.mm1) && this.mm2.equals(that.mm2));
|
||||
return (this == other || (other instanceof IntersectionMethodMatcher that &&
|
||||
this.mm1.equals(that.mm1) && this.mm2.equals(that.mm2)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,13 +68,9 @@ public class AnnotationClassFilter implements ClassFilter {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof AnnotationClassFilter otherCf)) {
|
||||
return false;
|
||||
}
|
||||
return (this.annotationType.equals(otherCf.annotationType) && this.checkInherited == otherCf.checkInherited);
|
||||
return (this == other || (other instanceof AnnotationClassFilter otherCf &&
|
||||
this.annotationType.equals(otherCf.annotationType) &&
|
||||
this.checkInherited == otherCf.checkInherited));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -121,14 +121,9 @@ public class AnnotationMatchingPointcut implements Pointcut {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof AnnotationMatchingPointcut otherPointcut)) {
|
||||
return false;
|
||||
}
|
||||
return (this.classFilter.equals(otherPointcut.classFilter) &&
|
||||
this.methodMatcher.equals(otherPointcut.methodMatcher));
|
||||
return (this == other || (other instanceof AnnotationMatchingPointcut otherPointcut &&
|
||||
this.classFilter.equals(otherPointcut.classFilter) &&
|
||||
this.methodMatcher.equals(otherPointcut.methodMatcher)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -183,14 +178,9 @@ public class AnnotationMatchingPointcut implements Pointcut {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof AnnotationCandidateClassFilter that)) {
|
||||
return false;
|
||||
}
|
||||
return this.annotationType.equals(that.annotationType);
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof AnnotationCandidateClassFilter that &&
|
||||
this.annotationType.equals(that.annotationType)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,10 +27,9 @@ import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Simple {@link org.springframework.aop.MethodMatcher MethodMatcher} that looks
|
||||
* for a specific annotation being present on a method (checking both the method
|
||||
* on the invoked interface, if any, and the corresponding method on the target
|
||||
* class).
|
||||
* Simple {@link org.springframework.aop.MethodMatcher MethodMatcher} that looks for
|
||||
* a specific annotation being present on a method (checking both the method on the
|
||||
* invoked interface, if any, and the corresponding method on the target class).
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
@@ -90,13 +89,9 @@ public class AnnotationMethodMatcher extends StaticMethodMatcher {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof AnnotationMethodMatcher otherMm)) {
|
||||
return false;
|
||||
}
|
||||
return (this.annotationType.equals(otherMm.annotationType) && this.checkInherited == otherMm.checkInherited);
|
||||
return (this == other || (other instanceof AnnotationMethodMatcher otherMm &&
|
||||
this.annotationType.equals(otherMm.annotationType) &&
|
||||
this.checkInherited == otherMm.checkInherited));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -165,14 +165,9 @@ public class AnnotationCacheOperationSource extends AbstractFallbackCacheOperati
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof AnnotationCacheOperationSource otherCos)) {
|
||||
return false;
|
||||
}
|
||||
return (this.annotationParsers.equals(otherCos.annotationParsers) &&
|
||||
this.publicMethodsOnly == otherCos.publicMethodsOnly);
|
||||
return (this == other || (other instanceof AnnotationCacheOperationSource otherCos &&
|
||||
this.annotationParsers.equals(otherCos.annotationParsers) &&
|
||||
this.publicMethodsOnly == otherCos.publicMethodsOnly));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -111,13 +111,8 @@ public class NameMatchCacheOperationSource implements CacheOperationSource, Seri
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof NameMatchCacheOperationSource otherTas)) {
|
||||
return false;
|
||||
}
|
||||
return ObjectUtils.nullSafeEquals(this.nameMap, otherTas.nameMap);
|
||||
return (this == other || (other instanceof NameMatchCacheOperationSource otherCos &&
|
||||
ObjectUtils.nullSafeEquals(this.nameMap, otherCos.nameMap)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,4 +124,5 @@ public class NameMatchCacheOperationSource implements CacheOperationSource, Seri
|
||||
public String toString() {
|
||||
return getClass().getName() + ": " + this.nameMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -191,14 +191,9 @@ public class AnnotationTransactionAttributeSource extends AbstractFallbackTransa
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof AnnotationTransactionAttributeSource otherTas)) {
|
||||
return false;
|
||||
}
|
||||
return (this.annotationParsers.equals(otherTas.annotationParsers) &&
|
||||
this.publicMethodsOnly == otherTas.publicMethodsOnly);
|
||||
return (this == other || (other instanceof AnnotationTransactionAttributeSource otherTas &&
|
||||
this.annotationParsers.equals(otherTas.annotationParsers) &&
|
||||
this.publicMethodsOnly == otherTas.publicMethodsOnly));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -239,13 +239,8 @@ public class MethodMapTransactionAttributeSource
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof MethodMapTransactionAttributeSource otherTas)) {
|
||||
return false;
|
||||
}
|
||||
return ObjectUtils.nullSafeEquals(this.methodMap, otherTas.methodMap);
|
||||
return (this == other || (other instanceof MethodMapTransactionAttributeSource otherTas &&
|
||||
ObjectUtils.nullSafeEquals(this.methodMap, otherTas.methodMap)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -164,13 +164,8 @@ public class NameMatchTransactionAttributeSource
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof NameMatchTransactionAttributeSource otherTas)) {
|
||||
return false;
|
||||
}
|
||||
return ObjectUtils.nullSafeEquals(this.nameMap, otherTas.nameMap);
|
||||
return (this == other || (other instanceof NameMatchTransactionAttributeSource otherTas &&
|
||||
ObjectUtils.nullSafeEquals(this.nameMap, otherTas.nameMap)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user