提交 c0db2079 编写于 作者: A Arjen Poutsma

Added @Override annotations to aop module

上级 c8e5aa07
......@@ -46,6 +46,7 @@ class TrueClassFilter implements ClassFilter, Serializable {
return INSTANCE;
}
@Override
public String toString() {
return "ClassFilter.TRUE";
}
......
......@@ -56,6 +56,7 @@ class TrueMethodMatcher implements MethodMatcher, Serializable {
return INSTANCE;
}
@Override
public String toString() {
return "MethodMatcher.TRUE";
}
......
......@@ -50,6 +50,7 @@ class TruePointcut implements Pointcut, Serializable {
return INSTANCE;
}
@Override
public String toString() {
return "Pointcut.TRUE";
}
......
......@@ -665,6 +665,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
}
@Override
public String toString() {
return getClass().getName() + ": advice method [" + this.aspectJAdviceMethod + "]; " +
"aspect name '" + this.aspectName + "'";
......
......@@ -48,6 +48,7 @@ public class AspectJAfterReturningAdvice extends AbstractAspectJAdvice implement
return true;
}
@Override
public void setReturningName(String name) {
setReturningNameNoCheck(name);
}
......
......@@ -45,6 +45,7 @@ public class AspectJAfterThrowingAdvice extends AbstractAspectJAdvice implements
return true;
}
@Override
public void setThrowingName(String name) {
setThrowingNameNoCheck(name);
}
......
......@@ -49,6 +49,7 @@ public class AspectJAroundAdvice extends AbstractAspectJAdvice implements Method
return false;
}
@Override
protected boolean supportsProceedingJoinPoint() {
return true;
}
......
......@@ -385,6 +385,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -399,6 +400,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
ObjectUtils.nullSafeEquals(this.pointcutParameterTypes, otherPc.pointcutParameterTypes);
}
@Override
public int hashCode() {
int hashCode = ObjectUtils.nullSafeHashCode(this.getExpression());
hashCode = 31 * hashCode + ObjectUtils.nullSafeHashCode(this.pointcutDeclarationScope);
......@@ -407,6 +409,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
return hashCode;
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("AspectJExpressionPointcut: ");
......
......@@ -78,6 +78,7 @@ public class AspectJPointcutAdvisor implements PointcutAdvisor, Ordered {
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -89,6 +90,7 @@ public class AspectJPointcutAdvisor implements PointcutAdvisor, Ordered {
return (ObjectUtils.nullSafeEquals(this.advice, otherAdvisor.advice));
}
@Override
public int hashCode() {
return AspectJPointcutAdvisor.class.hashCode();
}
......
......@@ -142,6 +142,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
return getClass().getName() + ": execution: [" + this.methodInvocation + "]";
}
@Override
public String toString() {
return getClass().getName() + ": " + toShortString();
}
......
......@@ -173,6 +173,7 @@ class RuntimeTestWalker {
return matches;
}
@Override
public void visit(Instanceof i) {
ResolvedType type = (ResolvedType) i.getType();
int varType = getVarType((ReflectionVar) i.getVar());
......@@ -234,6 +235,7 @@ class RuntimeTestWalker {
return this.testsSubtypeSensitiveVars;
}
@Override
public void visit(Instanceof i) {
ReflectionVar v = (ReflectionVar) i.getVar();
Object varUnderTest = v.getBindingAtJoinPoint(thisObj,targetObj,argsObjs);
......@@ -242,6 +244,7 @@ class RuntimeTestWalker {
}
}
@Override
public void visit(HasAnnotation hasAnn) {
// If you thought things were bad before, now we sink to new levels of horror...
ReflectionVar v = (ReflectionVar) hasAnn.getVar();
......
......@@ -300,6 +300,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
return this.argNames;
}
@Override
public String toString() {
return this.annotation.toString();
}
......
......@@ -86,6 +86,7 @@ public class AnnotationAwareAspectJAutoProxyCreator extends AspectJAwareAdvisorA
return advisors;
}
@Override
protected boolean isInfrastructureClass(Class beanClass) {
// Previously we setProxyTargetClass(true) in the constructor, but that has too
// broad an impact. Instead we now override isInfrastructureClass to avoid proxying
......@@ -130,6 +131,7 @@ public class AnnotationAwareAspectJAutoProxyCreator extends AspectJAwareAdvisorA
super(beanFactory, advisorFactory);
}
@Override
protected boolean isEligibleBean(String beanName) {
return AnnotationAwareAspectJAutoProxyCreator.this.isEligibleAspectBean(beanName);
}
......
......@@ -56,6 +56,7 @@ public class SimpleMetadataAwareAspectInstanceFactory extends SimpleAspectInstan
* <p>The default implementation simply returns <code>Ordered.LOWEST_PRECEDENCE</code>.
* @param aspectClass the aspect class
*/
@Override
protected int getOrderForAspectClass(Class aspectClass) {
Order order = (Order) aspectClass.getAnnotation(Order.class);
if (order != null) {
......
......@@ -57,6 +57,7 @@ public class SingletonMetadataAwareAspectInstanceFactory extends SingletonAspect
* falling back to <code>Ordered.LOWEST_PRECEDENCE</code>.
* @see org.springframework.core.annotation.Order
*/
@Override
protected int getOrderForAspectClass(Class aspectClass) {
Order order = (Order) aspectClass.getAnnotation(Order.class);
if (order != null) {
......
......@@ -64,6 +64,7 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
* advisor should run first. "On the way out" of a join point, the highest precedence
* advisor should run last.
*/
@Override
protected List sortAdvisors(List advisors) {
// build list for sorting
List partiallyComparableAdvisors = new LinkedList();
......@@ -96,10 +97,12 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
* These additional advices are needed when using AspectJ expression pointcuts
* and when using AspectJ-style advice.
*/
@Override
protected void extendAdvisors(List candidateAdvisors) {
AspectJProxyUtils.makeAdvisorChainAspectJCapableIfNecessary(candidateAdvisors);
}
@Override
protected boolean shouldSkip(Class beanClass, String beanName) {
// TODO: Consider optimization by caching the list of the aspect names
List candidtate = findCandidateAdvisors();
......@@ -141,6 +144,7 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
return this.advisor;
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
Advice advice = this.advisor.getAdvice();
......
......@@ -37,6 +37,7 @@ public class AdviceEntry implements ParseState.Entry {
this.kind = kind;
}
@Override
public String toString() {
return "Advice (" + this.kind + ")";
}
......
......@@ -95,14 +95,17 @@ public class AdvisorComponentDefinition extends AbstractComponentDefinition {
return this.advisorBeanName;
}
@Override
public String getDescription() {
return this.description;
}
@Override
public BeanDefinition[] getBeanDefinitions() {
return this.beanDefinitions;
}
@Override
public BeanReference[] getBeanReferences() {
return this.beanReferences;
}
......
......@@ -37,6 +37,7 @@ public class AdvisorEntry implements ParseState.Entry {
this.name = name;
}
@Override
public String toString() {
return "Advisor '" + this.name + "'";
}
......
......@@ -46,10 +46,12 @@ public class AspectComponentDefinition extends CompositeComponentDefinition {
}
@Override
public BeanDefinition[] getBeanDefinitions() {
return this.beanDefinitions;
}
@Override
public BeanReference[] getBeanReferences() {
return this.beanReferences;
}
......
......@@ -43,6 +43,7 @@ public class AspectEntry implements ParseState.Entry {
this.ref = ref;
}
@Override
public String toString() {
return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'" : "ref='" + this.ref + "'");
}
......
......@@ -50,10 +50,12 @@ public class PointcutComponentDefinition extends AbstractComponentDefinition {
return this.pointcutBeanName;
}
@Override
public String getDescription() {
return this.description;
}
@Override
public BeanDefinition[] getBeanDefinitions() {
return new BeanDefinition[] {this.pointcutDefinition};
}
......
......@@ -36,6 +36,7 @@ public class PointcutEntry implements ParseState.Entry {
this.name = name;
}
@Override
public String toString() {
return "Pointcut '" + this.name + "'";
}
......
......@@ -547,6 +547,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
/**
* For debugging/diagnostic use.
*/
@Override
public String toString() {
StringBuffer sb = new StringBuffer(getClass().getName() + ": ");
sb.append(this.interfaces.size()).append(" interfaces ");
......@@ -574,6 +575,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
this.hashCode = method.hashCode();
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
......@@ -582,6 +584,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
return (this.method == otherKey.method);
}
@Override
public int hashCode() {
return this.hashCode;
}
......
......@@ -352,11 +352,13 @@ final class Cglib2AopProxy implements AopProxy, Serializable {
}
@Override
public boolean equals(Object other) {
return (this == other || (other instanceof Cglib2AopProxy &&
AopProxyUtils.equalsInProxy(this.advised, ((Cglib2AopProxy) other).advised)));
}
@Override
public int hashCode() {
return Cglib2AopProxy.class.hashCode() * 13 + this.advised.getTargetSource().hashCode();
}
......@@ -649,6 +651,7 @@ final class Cglib2AopProxy implements AopProxy, Serializable {
}
}
@Override
public boolean equals(Object other) {
return (this == other ||
(other instanceof DynamicAdvisedInterceptor &&
......@@ -658,6 +661,7 @@ final class Cglib2AopProxy implements AopProxy, Serializable {
/**
* CGLIB uses this to drive proxy creation.
*/
@Override
public int hashCode() {
return this.advised.hashCode();
}
......@@ -692,6 +696,7 @@ final class Cglib2AopProxy implements AopProxy, Serializable {
* Gives a marginal performance improvement versus using reflection to
* invoke the target when invoking public methods.
*/
@Override
protected Object invokeJoinpoint() throws Throwable {
if (this.protectedMethod) {
return super.invokeJoinpoint();
......@@ -848,6 +853,7 @@ final class Cglib2AopProxy implements AopProxy, Serializable {
}
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
......@@ -915,6 +921,7 @@ final class Cglib2AopProxy implements AopProxy, Serializable {
return true;
}
@Override
public int hashCode() {
int hashCode = 0;
Advisor[] advisors = this.advised.getAdvisors();
......
......@@ -232,6 +232,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
* <p>The compared object may be a JdkDynamicAopProxy instance itself
* or a dynamic proxy wrapping a JdkDynamicAopProxy instance.
*/
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
......@@ -263,6 +264,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
/**
* Proxy uses the hash code of the TargetSource.
*/
@Override
public int hashCode() {
return JdkDynamicAopProxy.class.hashCode() * 13 + this.advised.getTargetSource().hashCode();
}
......
......@@ -158,6 +158,7 @@ public class ProxyConfig implements Serializable {
this.opaque = other.opaque;
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("proxyTargetClass=").append(this.proxyTargetClass).append("; ");
......
......@@ -121,6 +121,7 @@ public class ProxyCreatorSupport extends AdvisedSupport {
* Propagate advice change event to all AdvisedSupportListeners.
* @see AdvisedSupportListener#adviceChanged
*/
@Override
protected void adviceChanged() {
super.adviceChanged();
synchronized (this) {
......
......@@ -203,6 +203,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
this.advisorAdapterRegistry = advisorAdapterRegistry;
}
@Override
public void setFrozen(boolean frozen) {
this.freezeProxy = frozen;
}
......@@ -599,6 +600,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
/**
* Blow away and recache singleton on an advice change.
*/
@Override
protected void adviceChanged() {
super.adviceChanged();
if (this.singleton) {
......@@ -650,6 +652,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
throw new UnsupportedOperationException("Cannot invoke methods: " + this.message);
}
@Override
public String toString() {
return this.message;
}
......
......@@ -262,6 +262,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
}
@Override
public String toString() {
// Don't do toString on target, it may be proxied.
StringBuffer sb = new StringBuffer("ReflectiveMethodInvocation: ");
......
......@@ -49,6 +49,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
private BeanFactoryAdvisorRetrievalHelper advisorRetrievalHelper;
@Override
public void setBeanFactory(BeanFactory beanFactory) {
super.setBeanFactory(beanFactory);
if (!(beanFactory instanceof ConfigurableListableBeanFactory)) {
......@@ -62,6 +63,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
}
@Override
protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) {
List advisors = findEligibleAdvisors(beanClass, beanName);
if (advisors.isEmpty()) {
......@@ -155,6 +157,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
/**
* This auto-proxy creator always returns pre-filtered Advisors.
*/
@Override
protected boolean advisorsPreFiltered() {
return true;
}
......@@ -170,6 +173,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
super(beanFactory);
}
@Override
protected boolean isEligibleBean(String beanName) {
return AbstractAdvisorAutoProxyCreator.this.isEligibleAdvisorBean(beanName);
}
......
......@@ -172,10 +172,12 @@ public abstract class AbstractAutoProxyCreator extends ProxyConfig
* <p>Overridden from the super class to prevent the proxy configuration
* from being frozen before the proxy is created.
*/
@Override
public void setFrozen(boolean frozen) {
this.freezeProxy = frozen;
}
@Override
public boolean isFrozen() {
return this.freezeProxy;
}
......
......@@ -72,6 +72,7 @@ public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator {
/**
* Identify as bean to proxy if the bean name is in the configured list of names.
*/
@Override
protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) {
if (this.beanNames != null) {
for (Iterator it = this.beanNames.iterator(); it.hasNext();) {
......
......@@ -91,6 +91,7 @@ public class DefaultAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCrea
* @see #setUsePrefix
* @see #setAdvisorBeanNamePrefix
*/
@Override
protected boolean isEligibleAdvisorBean(String beanName) {
return (!isUsePrefix() || beanName.startsWith(getAdvisorBeanNamePrefix()));
}
......
......@@ -31,11 +31,13 @@ public class InfrastructureAdvisorAutoProxyCreator extends AbstractAdvisorAutoPr
private ConfigurableListableBeanFactory beanFactory;
@Override
protected void initBeanFactory(ConfigurableListableBeanFactory beanFactory) {
super.initBeanFactory(beanFactory);
this.beanFactory = beanFactory;
}
@Override
protected boolean isEligibleAdvisorBean(String beanName) {
return (this.beanFactory.containsBeanDefinition(beanName) &&
this.beanFactory.getBeanDefinition(beanName).getRole() == BeanDefinition.ROLE_INFRASTRUCTURE);
......
......@@ -53,10 +53,12 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
*/
public class LazyInitTargetSourceCreator extends AbstractBeanFactoryBasedTargetSourceCreator {
@Override
protected boolean isPrototypeBased() {
return false;
}
@Override
protected AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
Class beanClass, String beanName) {
......
......@@ -39,6 +39,7 @@ public class QuickTargetSourceCreator extends AbstractBeanFactoryBasedTargetSour
public static final String PREFIX_THREAD_LOCAL = "%";
public static final String PREFIX_PROTOTYPE = "!";
@Override
protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
Class beanClass, String beanName) {
......
......@@ -243,6 +243,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
* @see #setExitMessage
* @see #setExceptionMessage
*/
@Override
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
String name = invocation.getMethod().getDeclaringClass().getName() + "." + invocation.getMethod().getName();
StopWatch stopWatch = new StopWatch(name);
......
......@@ -54,6 +54,7 @@ public class DebugInterceptor extends SimpleTraceInterceptor {
}
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
synchronized (this) {
this.count++;
......@@ -61,6 +62,7 @@ public class DebugInterceptor extends SimpleTraceInterceptor {
return super.invoke(invocation);
}
@Override
protected String getInvocationDescription(MethodInvocation invocation) {
return invocation + "; count=" + this.count;
}
......
......@@ -131,6 +131,7 @@ public abstract class ExposeBeanNameAdvisors {
this.beanName = beanName;
}
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
if (!(mi instanceof ProxyMethodInvocation)) {
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
......
......@@ -49,9 +49,11 @@ public class ExposeInvocationInterceptor implements MethodInterceptor, Serializa
* Spring AOP, as it prevents the need to create a new Advisor to wrap the instance.
*/
public static final Advisor ADVISOR = new DefaultPointcutAdvisor(INSTANCE) {
@Override
public int getOrder() {
return Integer.MIN_VALUE;
}
@Override
public String toString() {
return ExposeInvocationInterceptor.class.getName() +".ADVISOR";
}
......
......@@ -88,6 +88,7 @@ public class JamonPerformanceMonitorInterceptor extends AbstractMonitoringInterc
* @see #setTrackAllInvocations
* @see #isLogEnabled
*/
@Override
protected boolean isInterceptorEnabled(MethodInvocation invocation, Log logger) {
return (this.trackAllInvocations || isLogEnabled(logger));
}
......@@ -98,6 +99,7 @@ public class JamonPerformanceMonitorInterceptor extends AbstractMonitoringInterc
* @see com.jamonapi.MonitorFactory#start
* @see com.jamonapi.Monitor#stop
*/
@Override
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
String name = createInvocationTraceName(invocation);
Monitor monitor = MonitorFactory.start(name);
......
......@@ -52,6 +52,7 @@ public class PerformanceMonitorInterceptor extends AbstractMonitoringInterceptor
}
@Override
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
String name = createInvocationTraceName(invocation);
StopWatch stopWatch = new StopWatch(name);
......
......@@ -51,6 +51,7 @@ public class SimpleTraceInterceptor extends AbstractTraceInterceptor {
}
@Override
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
String invocationDescription = getInvocationDescription(invocation);
logger.trace("Entering " + invocationDescription);
......
......@@ -80,6 +80,7 @@ public abstract class AbstractBeanFactoryPointcutAdvisor extends AbstractPointcu
}
}
@Override
public String toString() {
return getClass().getName() + ": advice bean '" + getAdviceBeanName() + "'";
}
......
......@@ -43,6 +43,7 @@ public abstract class AbstractGenericPointcutAdvisor extends AbstractPointcutAdv
}
@Override
public String toString() {
return getClass().getName() + ": advice [" + getAdvice() + "]";
}
......
......@@ -50,6 +50,7 @@ public abstract class AbstractPointcutAdvisor implements PointcutAdvisor, Ordere
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -62,6 +63,7 @@ public abstract class AbstractPointcutAdvisor implements PointcutAdvisor, Ordere
ObjectUtils.nullSafeEquals(getPointcut(), otherAdvisor.getPointcut()));
}
@Override
public int hashCode() {
return PointcutAdvisor.class.hashCode();
}
......
......@@ -181,6 +181,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
protected abstract boolean matchesExclusion(String pattern, int patternIndex);
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -193,6 +194,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
Arrays.equals(this.excludedPatterns, otherPointcut.excludedPatterns));
}
@Override
public int hashCode() {
int result = 27;
for (int i = 0; i < this.patterns.length; i++) {
......@@ -206,6 +208,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
return result;
}
@Override
public String toString() {
return getClass().getName() + ": patterns " + ObjectUtils.nullSafeToString(this.patterns) +
", excluded patterns " + ObjectUtils.nullSafeToString(this.excludedPatterns);
......
......@@ -104,11 +104,13 @@ public abstract class ClassFilters {
return false;
}
@Override
public boolean equals(Object other) {
return (this == other || (other instanceof UnionClassFilter &&
ObjectUtils.nullSafeEquals(this.filters, ((UnionClassFilter) other).filters)));
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.filters);
}
......@@ -135,11 +137,13 @@ public abstract class ClassFilters {
return true;
}
@Override
public boolean equals(Object other) {
return (this == other || (other instanceof IntersectionClassFilter &&
ObjectUtils.nullSafeEquals(this.filters, ((IntersectionClassFilter) other).filters)));
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.filters);
}
......
......@@ -179,6 +179,7 @@ public class ComposablePointcut implements Pointcut, Serializable {
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -192,6 +193,7 @@ public class ComposablePointcut implements Pointcut, Serializable {
ObjectUtils.nullSafeEquals(that.methodMatcher, this.methodMatcher);
}
@Override
public int hashCode() {
int code = 17;
if (this.classFilter != null) {
......@@ -203,6 +205,7 @@ public class ComposablePointcut implements Pointcut, Serializable {
return code;
}
@Override
public String toString() {
return "ComposablePointcut: ClassFilter [" + this.classFilter +
"], MethodMatcher [" + this.methodMatcher + "]";
......
......@@ -108,6 +108,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
return this;
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -119,6 +120,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
return (this.clazz.equals(that.clazz)) && ObjectUtils.nullSafeEquals(that.methodName, this.methodName);
}
@Override
public int hashCode() {
int code = 17;
code = 37 * code + this.clazz.hashCode();
......
......@@ -51,6 +51,7 @@ public class DefaultBeanFactoryPointcutAdvisor extends AbstractBeanFactoryPointc
}
@Override
public String toString() {
return getClass().getName() + ": pointcut [" + getPointcut() + "]; advice bean '" + getAdviceBeanName() + "'";
}
......
......@@ -144,6 +144,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -155,10 +156,12 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
return (this.advice.equals(otherAdvisor.advice) && this.interfaces.equals(otherAdvisor.interfaces));
}
@Override
public int hashCode() {
return this.advice.hashCode() * 13 + this.interfaces.hashCode();
}
@Override
public String toString() {
return ClassUtils.getShortName(getClass()) + ": advice [" + this.advice + "]; interfaces " +
ClassUtils.classNamesToString(this.interfaces);
......
......@@ -81,6 +81,7 @@ public class DefaultPointcutAdvisor extends AbstractGenericPointcutAdvisor imple
}
@Override
public String toString() {
return getClass().getName() + ": pointcut [" + getPointcut() + "]; advice [" + getAdvice() + "]";
}
......
......@@ -53,6 +53,7 @@ public class JdkRegexpMethodPointcut extends AbstractRegexpMethodPointcut {
/**
* Initialize {@link Pattern Patterns} from the supplied <code>String[]</code>.
*/
@Override
protected void initPatternRepresentation(String[] patterns) throws PatternSyntaxException {
this.compiledPatterns = compilePatterns(patterns);
}
......@@ -61,6 +62,7 @@ public class JdkRegexpMethodPointcut extends AbstractRegexpMethodPointcut {
* Returns <code>true</code> if the {@link Pattern} at index <code>patternIndex</code>
* matches the supplied candidate <code>String</code>.
*/
@Override
protected boolean matches(String pattern, int patternIndex) {
Matcher matcher = this.compiledPatterns[patternIndex].matcher(pattern);
return matcher.matches();
......@@ -69,6 +71,7 @@ public class JdkRegexpMethodPointcut extends AbstractRegexpMethodPointcut {
/**
* Initialize exclusion {@link Pattern Patterns} from the supplied <code>String[]</code>.
*/
@Override
protected void initExcludedPatternRepresentation(String[] excludedPatterns) throws IllegalArgumentException {
this.compiledExclusionPatterns = compilePatterns(excludedPatterns);
}
......@@ -77,6 +80,7 @@ public class JdkRegexpMethodPointcut extends AbstractRegexpMethodPointcut {
* Returns <code>true</code> if the exclusion {@link Pattern} at index <code>patternIndex</code>
* matches the supplied candidate <code>String</code>.
*/
@Override
protected boolean matchesExclusion(String candidate, int patternIndex) {
Matcher matcher = this.compiledExclusionPatterns[patternIndex].matcher(candidate);
return matcher.matches();
......
......@@ -137,6 +137,7 @@ public abstract class MethodMatchers {
return this.mm1.matches(method, targetClass, args) || this.mm2.matches(method, targetClass, args);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
......@@ -148,6 +149,7 @@ public abstract class MethodMatchers {
return (this.mm1.equals(that.mm1) && this.mm2.equals(that.mm2));
}
@Override
public int hashCode() {
int hashCode = 17;
hashCode = 37 * hashCode + this.mm1.hashCode();
......@@ -172,14 +174,17 @@ public abstract class MethodMatchers {
this.cf2 = cf2;
}
@Override
protected boolean matchesClass1(Class targetClass) {
return this.cf1.matches(targetClass);
}
@Override
protected boolean matchesClass2(Class targetClass) {
return this.cf2.matches(targetClass);
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -232,6 +237,7 @@ public abstract class MethodMatchers {
return aMatches && bMatches;
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -243,6 +249,7 @@ public abstract class MethodMatchers {
return (this.mm1.equals(that.mm1) && this.mm2.equals(that.mm2));
}
@Override
public int hashCode() {
int hashCode = 17;
hashCode = 37 * hashCode + this.mm1.hashCode();
......
......@@ -103,6 +103,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -111,6 +112,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
ObjectUtils.nullSafeEquals(this.mappedNames, ((NameMatchMethodPointcut) other).mappedNames));
}
@Override
public int hashCode() {
return (this.mappedNames != null ? this.mappedNames.hashCode() : 0);
}
......
......@@ -134,6 +134,7 @@ public class RegexpMethodPointcutAdvisor extends AbstractGenericPointcutAdvisor
return new JdkRegexpMethodPointcut();
}
@Override
public String toString() {
return getClass().getName() + ": advice [" + getAdvice() +
"], pointcut patterns " + ObjectUtils.nullSafeToString(this.patterns);
......
......@@ -181,6 +181,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -193,6 +194,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
ObjectUtils.nullSafeEquals(this.targetBeanName, otherTargetSource.targetBeanName));
}
@Override
public int hashCode() {
int hashCode = getClass().hashCode();
hashCode = 13 * hashCode + ObjectUtils.nullSafeHashCode(this.beanFactory);
......@@ -200,6 +202,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
return hashCode;
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(ClassUtils.getShortName(getClass()));
......
......@@ -73,6 +73,7 @@ public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBased
}
@Override
public final void setBeanFactory(BeanFactory beanFactory) throws BeansException {
super.setBeanFactory(beanFactory);
try {
......@@ -105,6 +106,7 @@ public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBased
* @throws Exception to allow pooling APIs to throw exception
* @see #getTarget
*/
@Override
public abstract void releaseTarget(Object target) throws Exception;
......
......@@ -39,6 +39,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
*/
public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFactoryBasedTargetSource {
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
super.setBeanFactory(beanFactory);
......
......@@ -207,6 +207,7 @@ public class CommonsPoolTargetSource extends AbstractPoolingTargetSource
* Creates and holds an ObjectPool instance.
* @see #createObjectPool()
*/
@Override
protected final void createPool() {
logger.debug("Creating Commons object pool");
this.pool = createObjectPool();
......@@ -236,6 +237,7 @@ public class CommonsPoolTargetSource extends AbstractPoolingTargetSource
/**
* Borrow an object from the <code>ObjectPool</code>.
*/
@Override
public Object getTarget() throws Exception {
return this.pool.borrowObject();
}
......@@ -243,6 +245,7 @@ public class CommonsPoolTargetSource extends AbstractPoolingTargetSource
/**
* Returns the specified object to the underlying <code>ObjectPool</code>.
*/
@Override
public void releaseTarget(Object target) throws Exception {
this.pool.returnObject(target);
}
......
......@@ -122,6 +122,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
return (this.targetClass == null && this.isStatic ? INSTANCE : this);
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -133,10 +134,12 @@ public class EmptyTargetSource implements TargetSource, Serializable {
return (ObjectUtils.nullSafeEquals(this.targetClass, otherTs.targetClass) && this.isStatic == otherTs.isStatic);
}
@Override
public int hashCode() {
return EmptyTargetSource.class.hashCode() * 13 + ObjectUtils.nullSafeHashCode(this.targetClass);
}
@Override
public String toString() {
return "EmptyTargetSource: " +
(this.targetClass != null ? "target class [" + this.targetClass.getName() + "]" : "no target class") +
......
......@@ -94,15 +94,18 @@ public class HotSwappableTargetSource implements TargetSource, Serializable {
* Two HotSwappableTargetSources are equal if the current target
* objects are equal.
*/
@Override
public boolean equals(Object other) {
return (this == other || (other instanceof HotSwappableTargetSource &&
this.target.equals(((HotSwappableTargetSource) other).target)));
}
@Override
public int hashCode() {
return HotSwappableTargetSource.class.hashCode();
}
@Override
public String toString() {
return "HotSwappableTargetSource for target: " + this.target;
}
......
......@@ -43,10 +43,12 @@ public class PrototypeTargetSource extends AbstractPrototypeBasedTargetSource {
* Destroy the given independent instance.
* @see #destroyPrototypeInstance
*/
@Override
public void releaseTarget(Object target) {
destroyPrototypeInstance(target);
}
@Override
public String toString() {
return "PrototypeTargetSource for target bean with name '" + getTargetBeanName() + "'";
}
......
......@@ -76,6 +76,7 @@ public class SingletonTargetSource implements TargetSource, Serializable {
* Two invoker interceptors are equal if they have the same target or if the
* targets or the targets are equal.
*/
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -90,10 +91,12 @@ public class SingletonTargetSource implements TargetSource, Serializable {
/**
* SingletonTargetSource uses the hash code of the target object.
*/
@Override
public int hashCode() {
return this.target.hashCode();
}
@Override
public String toString() {
return "SingletonTargetSource for target object [" + ObjectUtils.identityToString(this.target) + "]";
}
......
......@@ -57,6 +57,7 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
* is meant to be per thread per instance of the ThreadLocalTargetSource class.
*/
private final ThreadLocal targetInThread = new ThreadLocal() {
@Override
public String toString() {
return "Thread-local instance of bean '" + getTargetBeanName() + "'";
}
......
......@@ -61,6 +61,7 @@ public class BeanFactoryRefreshableTargetSource extends AbstractRefreshableTarge
/**
* Retrieve a fresh target object.
*/
@Override
protected final Object freshTarget() {
return this.obtainFreshBean(this.beanFactory, this.beanName);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册