diff --git a/org.springframework.aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java b/org.springframework.aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java index 0e58471655..4db89eb52f 100644 --- a/org.springframework.aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java +++ b/org.springframework.aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2010 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. @@ -34,22 +34,25 @@ import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; /** - * Base implementation for {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator BeanDefinitionDecorators} wishing - * to add an {@link org.aopalliance.intercept.MethodInterceptor interceptor} to the resulting - * bean. + * Base implementation for + * {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator BeanDefinitionDecorators} + * wishing to add an {@link org.aopalliance.intercept.MethodInterceptor interceptor} + * to the resulting bean. * *

This base class controls the creation of the {@link ProxyFactoryBean} bean definition - * and wraps the original as an inner-bean definition for the target property of - * {@link ProxyFactoryBean}. + * and wraps the original as an inner-bean definition for the target property + * of {@link ProxyFactoryBean}. * *

Chaining is correctly handled, ensuring that only one {@link ProxyFactoryBean} definition - * is created. If a previous {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator} already created the {@link org.springframework.aop.framework.ProxyFactoryBean} - * then the interceptor is simply added to the existing definition. + * is created. If a previous {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator} + * already created the {@link org.springframework.aop.framework.ProxyFactoryBean} then the + * interceptor is simply added to the existing definition. * - *

Subclasses have only to create the BeanDefinition to the interceptor they - * wish to add. + *

Subclasses have only to create the BeanDefinition to the interceptor that + * they wish to add. * * @author Rob Harrop + * @author Juergen Hoeller * @since 2.0 * @see org.aopalliance.intercept.MethodInterceptor */ @@ -72,7 +75,6 @@ public abstract class AbstractInterceptorDrivenBeanDefinitionDecorator implement BeanDefinitionHolder result = definitionHolder; if (!isProxyFactoryBeanDefinition(existingDefinition)) { - // create the proxy definitionHolder RootBeanDefinition proxyDefinition = new RootBeanDefinition(); // create proxy factory bean definitionHolder @@ -93,18 +95,17 @@ public abstract class AbstractInterceptorDrivenBeanDefinitionDecorator implement } addInterceptorNameToList(interceptorName, result.getBeanDefinition()); - return result; - } + @SuppressWarnings("unchecked") private void addInterceptorNameToList(String interceptorName, BeanDefinition beanDefinition) { - List list = (List) beanDefinition.getPropertyValues().getPropertyValue("interceptorNames").getValue(); + List list = (List) beanDefinition.getPropertyValues().getPropertyValue("interceptorNames").getValue(); list.add(interceptorName); } private boolean isProxyFactoryBeanDefinition(BeanDefinition existingDefinition) { - return existingDefinition.getBeanClassName().equals(ProxyFactoryBean.class.getName()); + return ProxyFactoryBean.class.getName().equals(existingDefinition.getBeanClassName()); } protected String getInterceptorNameSuffix(BeanDefinition interceptorDefinition) {