Added @Override annotations to aop module

This commit is contained in:
Arjen Poutsma 2008-10-27 23:31:39 +00:00
parent c8e5aa07a5
commit c0db207948
68 changed files with 134 additions and 0 deletions

View File

@ -46,6 +46,7 @@ class TrueClassFilter implements ClassFilter, Serializable {
return INSTANCE; return INSTANCE;
} }
@Override
public String toString() { public String toString() {
return "ClassFilter.TRUE"; return "ClassFilter.TRUE";
} }

View File

@ -56,6 +56,7 @@ class TrueMethodMatcher implements MethodMatcher, Serializable {
return INSTANCE; return INSTANCE;
} }
@Override
public String toString() { public String toString() {
return "MethodMatcher.TRUE"; return "MethodMatcher.TRUE";
} }

View File

@ -50,6 +50,7 @@ class TruePointcut implements Pointcut, Serializable {
return INSTANCE; return INSTANCE;
} }
@Override
public String toString() { public String toString() {
return "Pointcut.TRUE"; return "Pointcut.TRUE";
} }

View File

@ -665,6 +665,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": advice method [" + this.aspectJAdviceMethod + "]; " + return getClass().getName() + ": advice method [" + this.aspectJAdviceMethod + "]; " +
"aspect name '" + this.aspectName + "'"; "aspect name '" + this.aspectName + "'";

View File

@ -48,6 +48,7 @@ public class AspectJAfterReturningAdvice extends AbstractAspectJAdvice implement
return true; return true;
} }
@Override
public void setReturningName(String name) { public void setReturningName(String name) {
setReturningNameNoCheck(name); setReturningNameNoCheck(name);
} }

View File

@ -45,6 +45,7 @@ public class AspectJAfterThrowingAdvice extends AbstractAspectJAdvice implements
return true; return true;
} }
@Override
public void setThrowingName(String name) { public void setThrowingName(String name) {
setThrowingNameNoCheck(name); setThrowingNameNoCheck(name);
} }

View File

@ -49,6 +49,7 @@ public class AspectJAroundAdvice extends AbstractAspectJAdvice implements Method
return false; return false;
} }
@Override
protected boolean supportsProceedingJoinPoint() { protected boolean supportsProceedingJoinPoint() {
return true; return true;
} }

View File

@ -385,6 +385,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -399,6 +400,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
ObjectUtils.nullSafeEquals(this.pointcutParameterTypes, otherPc.pointcutParameterTypes); ObjectUtils.nullSafeEquals(this.pointcutParameterTypes, otherPc.pointcutParameterTypes);
} }
@Override
public int hashCode() { public int hashCode() {
int hashCode = ObjectUtils.nullSafeHashCode(this.getExpression()); int hashCode = ObjectUtils.nullSafeHashCode(this.getExpression());
hashCode = 31 * hashCode + ObjectUtils.nullSafeHashCode(this.pointcutDeclarationScope); hashCode = 31 * hashCode + ObjectUtils.nullSafeHashCode(this.pointcutDeclarationScope);
@ -407,6 +409,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
return hashCode; return hashCode;
} }
@Override
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
sb.append("AspectJExpressionPointcut: "); sb.append("AspectJExpressionPointcut: ");

View File

@ -78,6 +78,7 @@ public class AspectJPointcutAdvisor implements PointcutAdvisor, Ordered {
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -89,6 +90,7 @@ public class AspectJPointcutAdvisor implements PointcutAdvisor, Ordered {
return (ObjectUtils.nullSafeEquals(this.advice, otherAdvisor.advice)); return (ObjectUtils.nullSafeEquals(this.advice, otherAdvisor.advice));
} }
@Override
public int hashCode() { public int hashCode() {
return AspectJPointcutAdvisor.class.hashCode(); return AspectJPointcutAdvisor.class.hashCode();
} }

View File

@ -142,6 +142,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
return getClass().getName() + ": execution: [" + this.methodInvocation + "]"; return getClass().getName() + ": execution: [" + this.methodInvocation + "]";
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": " + toShortString(); return getClass().getName() + ": " + toShortString();
} }

View File

@ -173,6 +173,7 @@ class RuntimeTestWalker {
return matches; return matches;
} }
@Override
public void visit(Instanceof i) { public void visit(Instanceof i) {
ResolvedType type = (ResolvedType) i.getType(); ResolvedType type = (ResolvedType) i.getType();
int varType = getVarType((ReflectionVar) i.getVar()); int varType = getVarType((ReflectionVar) i.getVar());
@ -234,6 +235,7 @@ class RuntimeTestWalker {
return this.testsSubtypeSensitiveVars; return this.testsSubtypeSensitiveVars;
} }
@Override
public void visit(Instanceof i) { public void visit(Instanceof i) {
ReflectionVar v = (ReflectionVar) i.getVar(); ReflectionVar v = (ReflectionVar) i.getVar();
Object varUnderTest = v.getBindingAtJoinPoint(thisObj,targetObj,argsObjs); Object varUnderTest = v.getBindingAtJoinPoint(thisObj,targetObj,argsObjs);
@ -242,6 +244,7 @@ class RuntimeTestWalker {
} }
} }
@Override
public void visit(HasAnnotation hasAnn) { public void visit(HasAnnotation hasAnn) {
// If you thought things were bad before, now we sink to new levels of horror... // If you thought things were bad before, now we sink to new levels of horror...
ReflectionVar v = (ReflectionVar) hasAnn.getVar(); ReflectionVar v = (ReflectionVar) hasAnn.getVar();

View File

@ -300,6 +300,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
return this.argNames; return this.argNames;
} }
@Override
public String toString() { public String toString() {
return this.annotation.toString(); return this.annotation.toString();
} }

View File

@ -86,6 +86,7 @@ public class AnnotationAwareAspectJAutoProxyCreator extends AspectJAwareAdvisorA
return advisors; return advisors;
} }
@Override
protected boolean isInfrastructureClass(Class beanClass) { protected boolean isInfrastructureClass(Class beanClass) {
// Previously we setProxyTargetClass(true) in the constructor, but that has too // Previously we setProxyTargetClass(true) in the constructor, but that has too
// broad an impact. Instead we now override isInfrastructureClass to avoid proxying // broad an impact. Instead we now override isInfrastructureClass to avoid proxying
@ -130,6 +131,7 @@ public class AnnotationAwareAspectJAutoProxyCreator extends AspectJAwareAdvisorA
super(beanFactory, advisorFactory); super(beanFactory, advisorFactory);
} }
@Override
protected boolean isEligibleBean(String beanName) { protected boolean isEligibleBean(String beanName) {
return AnnotationAwareAspectJAutoProxyCreator.this.isEligibleAspectBean(beanName); return AnnotationAwareAspectJAutoProxyCreator.this.isEligibleAspectBean(beanName);
} }

View File

@ -56,6 +56,7 @@ public class SimpleMetadataAwareAspectInstanceFactory extends SimpleAspectInstan
* <p>The default implementation simply returns <code>Ordered.LOWEST_PRECEDENCE</code>. * <p>The default implementation simply returns <code>Ordered.LOWEST_PRECEDENCE</code>.
* @param aspectClass the aspect class * @param aspectClass the aspect class
*/ */
@Override
protected int getOrderForAspectClass(Class aspectClass) { protected int getOrderForAspectClass(Class aspectClass) {
Order order = (Order) aspectClass.getAnnotation(Order.class); Order order = (Order) aspectClass.getAnnotation(Order.class);
if (order != null) { if (order != null) {

View File

@ -57,6 +57,7 @@ public class SingletonMetadataAwareAspectInstanceFactory extends SingletonAspect
* falling back to <code>Ordered.LOWEST_PRECEDENCE</code>. * falling back to <code>Ordered.LOWEST_PRECEDENCE</code>.
* @see org.springframework.core.annotation.Order * @see org.springframework.core.annotation.Order
*/ */
@Override
protected int getOrderForAspectClass(Class aspectClass) { protected int getOrderForAspectClass(Class aspectClass) {
Order order = (Order) aspectClass.getAnnotation(Order.class); Order order = (Order) aspectClass.getAnnotation(Order.class);
if (order != null) { if (order != null) {

View File

@ -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 first. "On the way out" of a join point, the highest precedence
* advisor should run last. * advisor should run last.
*/ */
@Override
protected List sortAdvisors(List advisors) { protected List sortAdvisors(List advisors) {
// build list for sorting // build list for sorting
List partiallyComparableAdvisors = new LinkedList(); List partiallyComparableAdvisors = new LinkedList();
@ -96,10 +97,12 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
* These additional advices are needed when using AspectJ expression pointcuts * These additional advices are needed when using AspectJ expression pointcuts
* and when using AspectJ-style advice. * and when using AspectJ-style advice.
*/ */
@Override
protected void extendAdvisors(List candidateAdvisors) { protected void extendAdvisors(List candidateAdvisors) {
AspectJProxyUtils.makeAdvisorChainAspectJCapableIfNecessary(candidateAdvisors); AspectJProxyUtils.makeAdvisorChainAspectJCapableIfNecessary(candidateAdvisors);
} }
@Override
protected boolean shouldSkip(Class beanClass, String beanName) { protected boolean shouldSkip(Class beanClass, String beanName) {
// TODO: Consider optimization by caching the list of the aspect names // TODO: Consider optimization by caching the list of the aspect names
List candidtate = findCandidateAdvisors(); List candidtate = findCandidateAdvisors();
@ -141,6 +144,7 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
return this.advisor; return this.advisor;
} }
@Override
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
Advice advice = this.advisor.getAdvice(); Advice advice = this.advisor.getAdvice();

View File

@ -37,6 +37,7 @@ public class AdviceEntry implements ParseState.Entry {
this.kind = kind; this.kind = kind;
} }
@Override
public String toString() { public String toString() {
return "Advice (" + this.kind + ")"; return "Advice (" + this.kind + ")";
} }

View File

@ -95,14 +95,17 @@ public class AdvisorComponentDefinition extends AbstractComponentDefinition {
return this.advisorBeanName; return this.advisorBeanName;
} }
@Override
public String getDescription() { public String getDescription() {
return this.description; return this.description;
} }
@Override
public BeanDefinition[] getBeanDefinitions() { public BeanDefinition[] getBeanDefinitions() {
return this.beanDefinitions; return this.beanDefinitions;
} }
@Override
public BeanReference[] getBeanReferences() { public BeanReference[] getBeanReferences() {
return this.beanReferences; return this.beanReferences;
} }

View File

@ -37,6 +37,7 @@ public class AdvisorEntry implements ParseState.Entry {
this.name = name; this.name = name;
} }
@Override
public String toString() { public String toString() {
return "Advisor '" + this.name + "'"; return "Advisor '" + this.name + "'";
} }

View File

@ -46,10 +46,12 @@ public class AspectComponentDefinition extends CompositeComponentDefinition {
} }
@Override
public BeanDefinition[] getBeanDefinitions() { public BeanDefinition[] getBeanDefinitions() {
return this.beanDefinitions; return this.beanDefinitions;
} }
@Override
public BeanReference[] getBeanReferences() { public BeanReference[] getBeanReferences() {
return this.beanReferences; return this.beanReferences;
} }

View File

@ -43,6 +43,7 @@ public class AspectEntry implements ParseState.Entry {
this.ref = ref; this.ref = ref;
} }
@Override
public String toString() { public String toString() {
return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'" : "ref='" + this.ref + "'"); return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'" : "ref='" + this.ref + "'");
} }

View File

@ -50,10 +50,12 @@ public class PointcutComponentDefinition extends AbstractComponentDefinition {
return this.pointcutBeanName; return this.pointcutBeanName;
} }
@Override
public String getDescription() { public String getDescription() {
return this.description; return this.description;
} }
@Override
public BeanDefinition[] getBeanDefinitions() { public BeanDefinition[] getBeanDefinitions() {
return new BeanDefinition[] {this.pointcutDefinition}; return new BeanDefinition[] {this.pointcutDefinition};
} }

View File

@ -36,6 +36,7 @@ public class PointcutEntry implements ParseState.Entry {
this.name = name; this.name = name;
} }
@Override
public String toString() { public String toString() {
return "Pointcut '" + this.name + "'"; return "Pointcut '" + this.name + "'";
} }

View File

@ -547,6 +547,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
/** /**
* For debugging/diagnostic use. * For debugging/diagnostic use.
*/ */
@Override
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer(getClass().getName() + ": "); StringBuffer sb = new StringBuffer(getClass().getName() + ": ");
sb.append(this.interfaces.size()).append(" interfaces "); sb.append(this.interfaces.size()).append(" interfaces ");
@ -574,6 +575,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
this.hashCode = method.hashCode(); this.hashCode = method.hashCode();
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (other == this) { if (other == this) {
return true; return true;
@ -582,6 +584,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
return (this.method == otherKey.method); return (this.method == otherKey.method);
} }
@Override
public int hashCode() { public int hashCode() {
return this.hashCode; return this.hashCode;
} }

View File

@ -352,11 +352,13 @@ final class Cglib2AopProxy implements AopProxy, Serializable {
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
return (this == other || (other instanceof Cglib2AopProxy && return (this == other || (other instanceof Cglib2AopProxy &&
AopProxyUtils.equalsInProxy(this.advised, ((Cglib2AopProxy) other).advised))); AopProxyUtils.equalsInProxy(this.advised, ((Cglib2AopProxy) other).advised)));
} }
@Override
public int hashCode() { public int hashCode() {
return Cglib2AopProxy.class.hashCode() * 13 + this.advised.getTargetSource().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) { public boolean equals(Object other) {
return (this == other || return (this == other ||
(other instanceof DynamicAdvisedInterceptor && (other instanceof DynamicAdvisedInterceptor &&
@ -658,6 +661,7 @@ final class Cglib2AopProxy implements AopProxy, Serializable {
/** /**
* CGLIB uses this to drive proxy creation. * CGLIB uses this to drive proxy creation.
*/ */
@Override
public int hashCode() { public int hashCode() {
return this.advised.hashCode(); return this.advised.hashCode();
} }
@ -692,6 +696,7 @@ final class Cglib2AopProxy implements AopProxy, Serializable {
* Gives a marginal performance improvement versus using reflection to * Gives a marginal performance improvement versus using reflection to
* invoke the target when invoking public methods. * invoke the target when invoking public methods.
*/ */
@Override
protected Object invokeJoinpoint() throws Throwable { protected Object invokeJoinpoint() throws Throwable {
if (this.protectedMethod) { if (this.protectedMethod) {
return super.invokeJoinpoint(); return super.invokeJoinpoint();
@ -848,6 +853,7 @@ final class Cglib2AopProxy implements AopProxy, Serializable {
} }
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (other == this) { if (other == this) {
return true; return true;
@ -915,6 +921,7 @@ final class Cglib2AopProxy implements AopProxy, Serializable {
return true; return true;
} }
@Override
public int hashCode() { public int hashCode() {
int hashCode = 0; int hashCode = 0;
Advisor[] advisors = this.advised.getAdvisors(); Advisor[] advisors = this.advised.getAdvisors();

View File

@ -232,6 +232,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
* <p>The compared object may be a JdkDynamicAopProxy instance itself * <p>The compared object may be a JdkDynamicAopProxy instance itself
* or a dynamic proxy wrapping a JdkDynamicAopProxy instance. * or a dynamic proxy wrapping a JdkDynamicAopProxy instance.
*/ */
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (other == this) { if (other == this) {
return true; return true;
@ -263,6 +264,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
/** /**
* Proxy uses the hash code of the TargetSource. * Proxy uses the hash code of the TargetSource.
*/ */
@Override
public int hashCode() { public int hashCode() {
return JdkDynamicAopProxy.class.hashCode() * 13 + this.advised.getTargetSource().hashCode(); return JdkDynamicAopProxy.class.hashCode() * 13 + this.advised.getTargetSource().hashCode();
} }

View File

@ -158,6 +158,7 @@ public class ProxyConfig implements Serializable {
this.opaque = other.opaque; this.opaque = other.opaque;
} }
@Override
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
sb.append("proxyTargetClass=").append(this.proxyTargetClass).append("; "); sb.append("proxyTargetClass=").append(this.proxyTargetClass).append("; ");

View File

@ -121,6 +121,7 @@ public class ProxyCreatorSupport extends AdvisedSupport {
* Propagate advice change event to all AdvisedSupportListeners. * Propagate advice change event to all AdvisedSupportListeners.
* @see AdvisedSupportListener#adviceChanged * @see AdvisedSupportListener#adviceChanged
*/ */
@Override
protected void adviceChanged() { protected void adviceChanged() {
super.adviceChanged(); super.adviceChanged();
synchronized (this) { synchronized (this) {

View File

@ -203,6 +203,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
this.advisorAdapterRegistry = advisorAdapterRegistry; this.advisorAdapterRegistry = advisorAdapterRegistry;
} }
@Override
public void setFrozen(boolean frozen) { public void setFrozen(boolean frozen) {
this.freezeProxy = frozen; this.freezeProxy = frozen;
} }
@ -599,6 +600,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
/** /**
* Blow away and recache singleton on an advice change. * Blow away and recache singleton on an advice change.
*/ */
@Override
protected void adviceChanged() { protected void adviceChanged() {
super.adviceChanged(); super.adviceChanged();
if (this.singleton) { if (this.singleton) {
@ -650,6 +652,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
throw new UnsupportedOperationException("Cannot invoke methods: " + this.message); throw new UnsupportedOperationException("Cannot invoke methods: " + this.message);
} }
@Override
public String toString() { public String toString() {
return this.message; return this.message;
} }

View File

@ -262,6 +262,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
} }
@Override
public String toString() { public String toString() {
// Don't do toString on target, it may be proxied. // Don't do toString on target, it may be proxied.
StringBuffer sb = new StringBuffer("ReflectiveMethodInvocation: "); StringBuffer sb = new StringBuffer("ReflectiveMethodInvocation: ");

View File

@ -49,6 +49,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
private BeanFactoryAdvisorRetrievalHelper advisorRetrievalHelper; private BeanFactoryAdvisorRetrievalHelper advisorRetrievalHelper;
@Override
public void setBeanFactory(BeanFactory beanFactory) { public void setBeanFactory(BeanFactory beanFactory) {
super.setBeanFactory(beanFactory); super.setBeanFactory(beanFactory);
if (!(beanFactory instanceof ConfigurableListableBeanFactory)) { if (!(beanFactory instanceof ConfigurableListableBeanFactory)) {
@ -62,6 +63,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
} }
@Override
protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) { protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) {
List advisors = findEligibleAdvisors(beanClass, beanName); List advisors = findEligibleAdvisors(beanClass, beanName);
if (advisors.isEmpty()) { if (advisors.isEmpty()) {
@ -155,6 +157,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
/** /**
* This auto-proxy creator always returns pre-filtered Advisors. * This auto-proxy creator always returns pre-filtered Advisors.
*/ */
@Override
protected boolean advisorsPreFiltered() { protected boolean advisorsPreFiltered() {
return true; return true;
} }
@ -170,6 +173,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
super(beanFactory); super(beanFactory);
} }
@Override
protected boolean isEligibleBean(String beanName) { protected boolean isEligibleBean(String beanName) {
return AbstractAdvisorAutoProxyCreator.this.isEligibleAdvisorBean(beanName); return AbstractAdvisorAutoProxyCreator.this.isEligibleAdvisorBean(beanName);
} }

View File

@ -172,10 +172,12 @@ public abstract class AbstractAutoProxyCreator extends ProxyConfig
* <p>Overridden from the super class to prevent the proxy configuration * <p>Overridden from the super class to prevent the proxy configuration
* from being frozen before the proxy is created. * from being frozen before the proxy is created.
*/ */
@Override
public void setFrozen(boolean frozen) { public void setFrozen(boolean frozen) {
this.freezeProxy = frozen; this.freezeProxy = frozen;
} }
@Override
public boolean isFrozen() { public boolean isFrozen() {
return this.freezeProxy; return this.freezeProxy;
} }

View File

@ -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. * 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) { protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) {
if (this.beanNames != null) { if (this.beanNames != null) {
for (Iterator it = this.beanNames.iterator(); it.hasNext();) { for (Iterator it = this.beanNames.iterator(); it.hasNext();) {

View File

@ -91,6 +91,7 @@ public class DefaultAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCrea
* @see #setUsePrefix * @see #setUsePrefix
* @see #setAdvisorBeanNamePrefix * @see #setAdvisorBeanNamePrefix
*/ */
@Override
protected boolean isEligibleAdvisorBean(String beanName) { protected boolean isEligibleAdvisorBean(String beanName) {
return (!isUsePrefix() || beanName.startsWith(getAdvisorBeanNamePrefix())); return (!isUsePrefix() || beanName.startsWith(getAdvisorBeanNamePrefix()));
} }

View File

@ -31,11 +31,13 @@ public class InfrastructureAdvisorAutoProxyCreator extends AbstractAdvisorAutoPr
private ConfigurableListableBeanFactory beanFactory; private ConfigurableListableBeanFactory beanFactory;
@Override
protected void initBeanFactory(ConfigurableListableBeanFactory beanFactory) { protected void initBeanFactory(ConfigurableListableBeanFactory beanFactory) {
super.initBeanFactory(beanFactory); super.initBeanFactory(beanFactory);
this.beanFactory = beanFactory; this.beanFactory = beanFactory;
} }
@Override
protected boolean isEligibleAdvisorBean(String beanName) { protected boolean isEligibleAdvisorBean(String beanName) {
return (this.beanFactory.containsBeanDefinition(beanName) && return (this.beanFactory.containsBeanDefinition(beanName) &&
this.beanFactory.getBeanDefinition(beanName).getRole() == BeanDefinition.ROLE_INFRASTRUCTURE); this.beanFactory.getBeanDefinition(beanName).getRole() == BeanDefinition.ROLE_INFRASTRUCTURE);

View File

@ -53,10 +53,12 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
*/ */
public class LazyInitTargetSourceCreator extends AbstractBeanFactoryBasedTargetSourceCreator { public class LazyInitTargetSourceCreator extends AbstractBeanFactoryBasedTargetSourceCreator {
@Override
protected boolean isPrototypeBased() { protected boolean isPrototypeBased() {
return false; return false;
} }
@Override
protected AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource( protected AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
Class beanClass, String beanName) { Class beanClass, String beanName) {

View File

@ -39,6 +39,7 @@ public class QuickTargetSourceCreator extends AbstractBeanFactoryBasedTargetSour
public static final String PREFIX_THREAD_LOCAL = "%"; public static final String PREFIX_THREAD_LOCAL = "%";
public static final String PREFIX_PROTOTYPE = "!"; public static final String PREFIX_PROTOTYPE = "!";
@Override
protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource( protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
Class beanClass, String beanName) { Class beanClass, String beanName) {

View File

@ -243,6 +243,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
* @see #setExitMessage * @see #setExitMessage
* @see #setExceptionMessage * @see #setExceptionMessage
*/ */
@Override
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable { protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
String name = invocation.getMethod().getDeclaringClass().getName() + "." + invocation.getMethod().getName(); String name = invocation.getMethod().getDeclaringClass().getName() + "." + invocation.getMethod().getName();
StopWatch stopWatch = new StopWatch(name); StopWatch stopWatch = new StopWatch(name);

View File

@ -54,6 +54,7 @@ public class DebugInterceptor extends SimpleTraceInterceptor {
} }
@Override
public Object invoke(MethodInvocation invocation) throws Throwable { public Object invoke(MethodInvocation invocation) throws Throwable {
synchronized (this) { synchronized (this) {
this.count++; this.count++;
@ -61,6 +62,7 @@ public class DebugInterceptor extends SimpleTraceInterceptor {
return super.invoke(invocation); return super.invoke(invocation);
} }
@Override
protected String getInvocationDescription(MethodInvocation invocation) { protected String getInvocationDescription(MethodInvocation invocation) {
return invocation + "; count=" + this.count; return invocation + "; count=" + this.count;
} }

View File

@ -131,6 +131,7 @@ public abstract class ExposeBeanNameAdvisors {
this.beanName = beanName; this.beanName = beanName;
} }
@Override
public Object invoke(MethodInvocation mi) throws Throwable { public Object invoke(MethodInvocation mi) throws Throwable {
if (!(mi instanceof ProxyMethodInvocation)) { if (!(mi instanceof ProxyMethodInvocation)) {
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi); throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);

View File

@ -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. * Spring AOP, as it prevents the need to create a new Advisor to wrap the instance.
*/ */
public static final Advisor ADVISOR = new DefaultPointcutAdvisor(INSTANCE) { public static final Advisor ADVISOR = new DefaultPointcutAdvisor(INSTANCE) {
@Override
public int getOrder() { public int getOrder() {
return Integer.MIN_VALUE; return Integer.MIN_VALUE;
} }
@Override
public String toString() { public String toString() {
return ExposeInvocationInterceptor.class.getName() +".ADVISOR"; return ExposeInvocationInterceptor.class.getName() +".ADVISOR";
} }

View File

@ -88,6 +88,7 @@ public class JamonPerformanceMonitorInterceptor extends AbstractMonitoringInterc
* @see #setTrackAllInvocations * @see #setTrackAllInvocations
* @see #isLogEnabled * @see #isLogEnabled
*/ */
@Override
protected boolean isInterceptorEnabled(MethodInvocation invocation, Log logger) { protected boolean isInterceptorEnabled(MethodInvocation invocation, Log logger) {
return (this.trackAllInvocations || isLogEnabled(logger)); return (this.trackAllInvocations || isLogEnabled(logger));
} }
@ -98,6 +99,7 @@ public class JamonPerformanceMonitorInterceptor extends AbstractMonitoringInterc
* @see com.jamonapi.MonitorFactory#start * @see com.jamonapi.MonitorFactory#start
* @see com.jamonapi.Monitor#stop * @see com.jamonapi.Monitor#stop
*/ */
@Override
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable { protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
String name = createInvocationTraceName(invocation); String name = createInvocationTraceName(invocation);
Monitor monitor = MonitorFactory.start(name); Monitor monitor = MonitorFactory.start(name);

View File

@ -52,6 +52,7 @@ public class PerformanceMonitorInterceptor extends AbstractMonitoringInterceptor
} }
@Override
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable { protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
String name = createInvocationTraceName(invocation); String name = createInvocationTraceName(invocation);
StopWatch stopWatch = new StopWatch(name); StopWatch stopWatch = new StopWatch(name);

View File

@ -51,6 +51,7 @@ public class SimpleTraceInterceptor extends AbstractTraceInterceptor {
} }
@Override
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable { protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
String invocationDescription = getInvocationDescription(invocation); String invocationDescription = getInvocationDescription(invocation);
logger.trace("Entering " + invocationDescription); logger.trace("Entering " + invocationDescription);

View File

@ -80,6 +80,7 @@ public abstract class AbstractBeanFactoryPointcutAdvisor extends AbstractPointcu
} }
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": advice bean '" + getAdviceBeanName() + "'"; return getClass().getName() + ": advice bean '" + getAdviceBeanName() + "'";
} }

View File

@ -43,6 +43,7 @@ public abstract class AbstractGenericPointcutAdvisor extends AbstractPointcutAdv
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": advice [" + getAdvice() + "]"; return getClass().getName() + ": advice [" + getAdvice() + "]";
} }

View File

@ -50,6 +50,7 @@ public abstract class AbstractPointcutAdvisor implements PointcutAdvisor, Ordere
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -62,6 +63,7 @@ public abstract class AbstractPointcutAdvisor implements PointcutAdvisor, Ordere
ObjectUtils.nullSafeEquals(getPointcut(), otherAdvisor.getPointcut())); ObjectUtils.nullSafeEquals(getPointcut(), otherAdvisor.getPointcut()));
} }
@Override
public int hashCode() { public int hashCode() {
return PointcutAdvisor.class.hashCode(); return PointcutAdvisor.class.hashCode();
} }

View File

@ -181,6 +181,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
protected abstract boolean matchesExclusion(String pattern, int patternIndex); protected abstract boolean matchesExclusion(String pattern, int patternIndex);
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -193,6 +194,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
Arrays.equals(this.excludedPatterns, otherPointcut.excludedPatterns)); Arrays.equals(this.excludedPatterns, otherPointcut.excludedPatterns));
} }
@Override
public int hashCode() { public int hashCode() {
int result = 27; int result = 27;
for (int i = 0; i < this.patterns.length; i++) { for (int i = 0; i < this.patterns.length; i++) {
@ -206,6 +208,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
return result; return result;
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": patterns " + ObjectUtils.nullSafeToString(this.patterns) + return getClass().getName() + ": patterns " + ObjectUtils.nullSafeToString(this.patterns) +
", excluded patterns " + ObjectUtils.nullSafeToString(this.excludedPatterns); ", excluded patterns " + ObjectUtils.nullSafeToString(this.excludedPatterns);

View File

@ -104,11 +104,13 @@ public abstract class ClassFilters {
return false; return false;
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
return (this == other || (other instanceof UnionClassFilter && return (this == other || (other instanceof UnionClassFilter &&
ObjectUtils.nullSafeEquals(this.filters, ((UnionClassFilter) other).filters))); ObjectUtils.nullSafeEquals(this.filters, ((UnionClassFilter) other).filters)));
} }
@Override
public int hashCode() { public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.filters); return ObjectUtils.nullSafeHashCode(this.filters);
} }
@ -135,11 +137,13 @@ public abstract class ClassFilters {
return true; return true;
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
return (this == other || (other instanceof IntersectionClassFilter && return (this == other || (other instanceof IntersectionClassFilter &&
ObjectUtils.nullSafeEquals(this.filters, ((IntersectionClassFilter) other).filters))); ObjectUtils.nullSafeEquals(this.filters, ((IntersectionClassFilter) other).filters)));
} }
@Override
public int hashCode() { public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.filters); return ObjectUtils.nullSafeHashCode(this.filters);
} }

View File

@ -179,6 +179,7 @@ public class ComposablePointcut implements Pointcut, Serializable {
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -192,6 +193,7 @@ public class ComposablePointcut implements Pointcut, Serializable {
ObjectUtils.nullSafeEquals(that.methodMatcher, this.methodMatcher); ObjectUtils.nullSafeEquals(that.methodMatcher, this.methodMatcher);
} }
@Override
public int hashCode() { public int hashCode() {
int code = 17; int code = 17;
if (this.classFilter != null) { if (this.classFilter != null) {
@ -203,6 +205,7 @@ public class ComposablePointcut implements Pointcut, Serializable {
return code; return code;
} }
@Override
public String toString() { public String toString() {
return "ComposablePointcut: ClassFilter [" + this.classFilter + return "ComposablePointcut: ClassFilter [" + this.classFilter +
"], MethodMatcher [" + this.methodMatcher + "]"; "], MethodMatcher [" + this.methodMatcher + "]";

View File

@ -108,6 +108,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
return this; return this;
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; 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); return (this.clazz.equals(that.clazz)) && ObjectUtils.nullSafeEquals(that.methodName, this.methodName);
} }
@Override
public int hashCode() { public int hashCode() {
int code = 17; int code = 17;
code = 37 * code + this.clazz.hashCode(); code = 37 * code + this.clazz.hashCode();

View File

@ -51,6 +51,7 @@ public class DefaultBeanFactoryPointcutAdvisor extends AbstractBeanFactoryPointc
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": pointcut [" + getPointcut() + "]; advice bean '" + getAdviceBeanName() + "'"; return getClass().getName() + ": pointcut [" + getPointcut() + "]; advice bean '" + getAdviceBeanName() + "'";
} }

View File

@ -144,6 +144,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -155,10 +156,12 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
return (this.advice.equals(otherAdvisor.advice) && this.interfaces.equals(otherAdvisor.interfaces)); return (this.advice.equals(otherAdvisor.advice) && this.interfaces.equals(otherAdvisor.interfaces));
} }
@Override
public int hashCode() { public int hashCode() {
return this.advice.hashCode() * 13 + this.interfaces.hashCode(); return this.advice.hashCode() * 13 + this.interfaces.hashCode();
} }
@Override
public String toString() { public String toString() {
return ClassUtils.getShortName(getClass()) + ": advice [" + this.advice + "]; interfaces " + return ClassUtils.getShortName(getClass()) + ": advice [" + this.advice + "]; interfaces " +
ClassUtils.classNamesToString(this.interfaces); ClassUtils.classNamesToString(this.interfaces);

View File

@ -81,6 +81,7 @@ public class DefaultPointcutAdvisor extends AbstractGenericPointcutAdvisor imple
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": pointcut [" + getPointcut() + "]; advice [" + getAdvice() + "]"; return getClass().getName() + ": pointcut [" + getPointcut() + "]; advice [" + getAdvice() + "]";
} }

View File

@ -53,6 +53,7 @@ public class JdkRegexpMethodPointcut extends AbstractRegexpMethodPointcut {
/** /**
* Initialize {@link Pattern Patterns} from the supplied <code>String[]</code>. * Initialize {@link Pattern Patterns} from the supplied <code>String[]</code>.
*/ */
@Override
protected void initPatternRepresentation(String[] patterns) throws PatternSyntaxException { protected void initPatternRepresentation(String[] patterns) throws PatternSyntaxException {
this.compiledPatterns = compilePatterns(patterns); 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> * Returns <code>true</code> if the {@link Pattern} at index <code>patternIndex</code>
* matches the supplied candidate <code>String</code>. * matches the supplied candidate <code>String</code>.
*/ */
@Override
protected boolean matches(String pattern, int patternIndex) { protected boolean matches(String pattern, int patternIndex) {
Matcher matcher = this.compiledPatterns[patternIndex].matcher(pattern); Matcher matcher = this.compiledPatterns[patternIndex].matcher(pattern);
return matcher.matches(); return matcher.matches();
@ -69,6 +71,7 @@ public class JdkRegexpMethodPointcut extends AbstractRegexpMethodPointcut {
/** /**
* Initialize exclusion {@link Pattern Patterns} from the supplied <code>String[]</code>. * Initialize exclusion {@link Pattern Patterns} from the supplied <code>String[]</code>.
*/ */
@Override
protected void initExcludedPatternRepresentation(String[] excludedPatterns) throws IllegalArgumentException { protected void initExcludedPatternRepresentation(String[] excludedPatterns) throws IllegalArgumentException {
this.compiledExclusionPatterns = compilePatterns(excludedPatterns); 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> * Returns <code>true</code> if the exclusion {@link Pattern} at index <code>patternIndex</code>
* matches the supplied candidate <code>String</code>. * matches the supplied candidate <code>String</code>.
*/ */
@Override
protected boolean matchesExclusion(String candidate, int patternIndex) { protected boolean matchesExclusion(String candidate, int patternIndex) {
Matcher matcher = this.compiledExclusionPatterns[patternIndex].matcher(candidate); Matcher matcher = this.compiledExclusionPatterns[patternIndex].matcher(candidate);
return matcher.matches(); return matcher.matches();

View File

@ -137,6 +137,7 @@ public abstract class MethodMatchers {
return this.mm1.matches(method, targetClass, args) || this.mm2.matches(method, targetClass, args); return this.mm1.matches(method, targetClass, args) || this.mm2.matches(method, targetClass, args);
} }
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
@ -148,6 +149,7 @@ public abstract class MethodMatchers {
return (this.mm1.equals(that.mm1) && this.mm2.equals(that.mm2)); return (this.mm1.equals(that.mm1) && this.mm2.equals(that.mm2));
} }
@Override
public int hashCode() { public int hashCode() {
int hashCode = 17; int hashCode = 17;
hashCode = 37 * hashCode + this.mm1.hashCode(); hashCode = 37 * hashCode + this.mm1.hashCode();
@ -172,14 +174,17 @@ public abstract class MethodMatchers {
this.cf2 = cf2; this.cf2 = cf2;
} }
@Override
protected boolean matchesClass1(Class targetClass) { protected boolean matchesClass1(Class targetClass) {
return this.cf1.matches(targetClass); return this.cf1.matches(targetClass);
} }
@Override
protected boolean matchesClass2(Class targetClass) { protected boolean matchesClass2(Class targetClass) {
return this.cf2.matches(targetClass); return this.cf2.matches(targetClass);
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -232,6 +237,7 @@ public abstract class MethodMatchers {
return aMatches && bMatches; return aMatches && bMatches;
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -243,6 +249,7 @@ public abstract class MethodMatchers {
return (this.mm1.equals(that.mm1) && this.mm2.equals(that.mm2)); return (this.mm1.equals(that.mm1) && this.mm2.equals(that.mm2));
} }
@Override
public int hashCode() { public int hashCode() {
int hashCode = 17; int hashCode = 17;
hashCode = 37 * hashCode + this.mm1.hashCode(); hashCode = 37 * hashCode + this.mm1.hashCode();

View File

@ -103,6 +103,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -111,6 +112,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
ObjectUtils.nullSafeEquals(this.mappedNames, ((NameMatchMethodPointcut) other).mappedNames)); ObjectUtils.nullSafeEquals(this.mappedNames, ((NameMatchMethodPointcut) other).mappedNames));
} }
@Override
public int hashCode() { public int hashCode() {
return (this.mappedNames != null ? this.mappedNames.hashCode() : 0); return (this.mappedNames != null ? this.mappedNames.hashCode() : 0);
} }

View File

@ -134,6 +134,7 @@ public class RegexpMethodPointcutAdvisor extends AbstractGenericPointcutAdvisor
return new JdkRegexpMethodPointcut(); return new JdkRegexpMethodPointcut();
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": advice [" + getAdvice() + return getClass().getName() + ": advice [" + getAdvice() +
"], pointcut patterns " + ObjectUtils.nullSafeToString(this.patterns); "], pointcut patterns " + ObjectUtils.nullSafeToString(this.patterns);

View File

@ -181,6 +181,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -193,6 +194,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
ObjectUtils.nullSafeEquals(this.targetBeanName, otherTargetSource.targetBeanName)); ObjectUtils.nullSafeEquals(this.targetBeanName, otherTargetSource.targetBeanName));
} }
@Override
public int hashCode() { public int hashCode() {
int hashCode = getClass().hashCode(); int hashCode = getClass().hashCode();
hashCode = 13 * hashCode + ObjectUtils.nullSafeHashCode(this.beanFactory); hashCode = 13 * hashCode + ObjectUtils.nullSafeHashCode(this.beanFactory);
@ -200,6 +202,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
return hashCode; return hashCode;
} }
@Override
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
sb.append(ClassUtils.getShortName(getClass())); sb.append(ClassUtils.getShortName(getClass()));

View File

@ -73,6 +73,7 @@ public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBased
} }
@Override
public final void setBeanFactory(BeanFactory beanFactory) throws BeansException { public final void setBeanFactory(BeanFactory beanFactory) throws BeansException {
super.setBeanFactory(beanFactory); super.setBeanFactory(beanFactory);
try { try {
@ -105,6 +106,7 @@ public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBased
* @throws Exception to allow pooling APIs to throw exception * @throws Exception to allow pooling APIs to throw exception
* @see #getTarget * @see #getTarget
*/ */
@Override
public abstract void releaseTarget(Object target) throws Exception; public abstract void releaseTarget(Object target) throws Exception;

View File

@ -39,6 +39,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
*/ */
public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFactoryBasedTargetSource { public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFactoryBasedTargetSource {
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException { public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
super.setBeanFactory(beanFactory); super.setBeanFactory(beanFactory);

View File

@ -207,6 +207,7 @@ public class CommonsPoolTargetSource extends AbstractPoolingTargetSource
* Creates and holds an ObjectPool instance. * Creates and holds an ObjectPool instance.
* @see #createObjectPool() * @see #createObjectPool()
*/ */
@Override
protected final void createPool() { protected final void createPool() {
logger.debug("Creating Commons object pool"); logger.debug("Creating Commons object pool");
this.pool = createObjectPool(); this.pool = createObjectPool();
@ -236,6 +237,7 @@ public class CommonsPoolTargetSource extends AbstractPoolingTargetSource
/** /**
* Borrow an object from the <code>ObjectPool</code>. * Borrow an object from the <code>ObjectPool</code>.
*/ */
@Override
public Object getTarget() throws Exception { public Object getTarget() throws Exception {
return this.pool.borrowObject(); return this.pool.borrowObject();
} }
@ -243,6 +245,7 @@ public class CommonsPoolTargetSource extends AbstractPoolingTargetSource
/** /**
* Returns the specified object to the underlying <code>ObjectPool</code>. * Returns the specified object to the underlying <code>ObjectPool</code>.
*/ */
@Override
public void releaseTarget(Object target) throws Exception { public void releaseTarget(Object target) throws Exception {
this.pool.returnObject(target); this.pool.returnObject(target);
} }

View File

@ -122,6 +122,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
return (this.targetClass == null && this.isStatic ? INSTANCE : this); return (this.targetClass == null && this.isStatic ? INSTANCE : this);
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -133,10 +134,12 @@ public class EmptyTargetSource implements TargetSource, Serializable {
return (ObjectUtils.nullSafeEquals(this.targetClass, otherTs.targetClass) && this.isStatic == otherTs.isStatic); return (ObjectUtils.nullSafeEquals(this.targetClass, otherTs.targetClass) && this.isStatic == otherTs.isStatic);
} }
@Override
public int hashCode() { public int hashCode() {
return EmptyTargetSource.class.hashCode() * 13 + ObjectUtils.nullSafeHashCode(this.targetClass); return EmptyTargetSource.class.hashCode() * 13 + ObjectUtils.nullSafeHashCode(this.targetClass);
} }
@Override
public String toString() { public String toString() {
return "EmptyTargetSource: " + return "EmptyTargetSource: " +
(this.targetClass != null ? "target class [" + this.targetClass.getName() + "]" : "no target class") + (this.targetClass != null ? "target class [" + this.targetClass.getName() + "]" : "no target class") +

View File

@ -94,15 +94,18 @@ public class HotSwappableTargetSource implements TargetSource, Serializable {
* Two HotSwappableTargetSources are equal if the current target * Two HotSwappableTargetSources are equal if the current target
* objects are equal. * objects are equal.
*/ */
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
return (this == other || (other instanceof HotSwappableTargetSource && return (this == other || (other instanceof HotSwappableTargetSource &&
this.target.equals(((HotSwappableTargetSource) other).target))); this.target.equals(((HotSwappableTargetSource) other).target)));
} }
@Override
public int hashCode() { public int hashCode() {
return HotSwappableTargetSource.class.hashCode(); return HotSwappableTargetSource.class.hashCode();
} }
@Override
public String toString() { public String toString() {
return "HotSwappableTargetSource for target: " + this.target; return "HotSwappableTargetSource for target: " + this.target;
} }

View File

@ -43,10 +43,12 @@ public class PrototypeTargetSource extends AbstractPrototypeBasedTargetSource {
* Destroy the given independent instance. * Destroy the given independent instance.
* @see #destroyPrototypeInstance * @see #destroyPrototypeInstance
*/ */
@Override
public void releaseTarget(Object target) { public void releaseTarget(Object target) {
destroyPrototypeInstance(target); destroyPrototypeInstance(target);
} }
@Override
public String toString() { public String toString() {
return "PrototypeTargetSource for target bean with name '" + getTargetBeanName() + "'"; return "PrototypeTargetSource for target bean with name '" + getTargetBeanName() + "'";
} }

View File

@ -76,6 +76,7 @@ public class SingletonTargetSource implements TargetSource, Serializable {
* Two invoker interceptors are equal if they have the same target or if the * Two invoker interceptors are equal if they have the same target or if the
* targets or the targets are equal. * targets or the targets are equal.
*/ */
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -90,10 +91,12 @@ public class SingletonTargetSource implements TargetSource, Serializable {
/** /**
* SingletonTargetSource uses the hash code of the target object. * SingletonTargetSource uses the hash code of the target object.
*/ */
@Override
public int hashCode() { public int hashCode() {
return this.target.hashCode(); return this.target.hashCode();
} }
@Override
public String toString() { public String toString() {
return "SingletonTargetSource for target object [" + ObjectUtils.identityToString(this.target) + "]"; return "SingletonTargetSource for target object [" + ObjectUtils.identityToString(this.target) + "]";
} }

View File

@ -57,6 +57,7 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
* is meant to be per thread per instance of the ThreadLocalTargetSource class. * is meant to be per thread per instance of the ThreadLocalTargetSource class.
*/ */
private final ThreadLocal targetInThread = new ThreadLocal() { private final ThreadLocal targetInThread = new ThreadLocal() {
@Override
public String toString() { public String toString() {
return "Thread-local instance of bean '" + getTargetBeanName() + "'"; return "Thread-local instance of bean '" + getTargetBeanName() + "'";
} }

View File

@ -61,6 +61,7 @@ public class BeanFactoryRefreshableTargetSource extends AbstractRefreshableTarge
/** /**
* Retrieve a fresh target object. * Retrieve a fresh target object.
*/ */
@Override
protected final Object freshTarget() { protected final Object freshTarget() {
return this.obtainFreshBean(this.beanFactory, this.beanName); return this.obtainFreshBean(this.beanFactory, this.beanName);
} }