Java 5 code style
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -98,8 +98,7 @@ public abstract class AopNamespaceUtils {
|
||||
|
||||
private static void useClassProxyingIfNecessary(BeanDefinitionRegistry registry, Element sourceElement) {
|
||||
if (sourceElement != null) {
|
||||
boolean proxyTargetClass = Boolean.valueOf(
|
||||
sourceElement.getAttribute(PROXY_TARGET_CLASS_ATTRIBUTE)).booleanValue();
|
||||
boolean proxyTargetClass = Boolean.valueOf(sourceElement.getAttribute(PROXY_TARGET_CLASS_ATTRIBUTE));
|
||||
if (proxyTargetClass) {
|
||||
AopConfigUtils.forceAutoProxyCreatorToUseClassProxying(registry);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -38,7 +40,7 @@ import org.springframework.aop.target.EmptyTargetSource;
|
||||
import org.springframework.aop.target.SingletonTargetSource;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* Base class for AOP proxy configuration managers.
|
||||
@@ -309,12 +311,30 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||
/**
|
||||
* Add all of the given advisors to this proxy configuration.
|
||||
* @param advisors the advisors to register
|
||||
* @deprecated as of Spring 3.0, in favor of {@link #addAdvisors}
|
||||
*/
|
||||
@Deprecated
|
||||
public void addAllAdvisors(Advisor[] advisors) {
|
||||
addAdvisors(Arrays.asList(advisors));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all of the given advisors to this proxy configuration.
|
||||
* @param advisors the advisors to register
|
||||
*/
|
||||
public void addAdvisors(Advisor... advisors) {
|
||||
addAdvisors(Arrays.asList(advisors));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all of the given advisors to this proxy configuration.
|
||||
* @param advisors the advisors to register
|
||||
*/
|
||||
public void addAdvisors(Collection<Advisor> advisors) {
|
||||
if (isFrozen()) {
|
||||
throw new AopConfigException("Cannot add advisor: Configuration is frozen.");
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(advisors)) {
|
||||
if (!CollectionUtils.isEmpty(advisors)) {
|
||||
for (Advisor advisor : advisors) {
|
||||
if (advisor instanceof IntroductionAdvisor) {
|
||||
validateIntroductionAdvisor((IntroductionAdvisor) advisor);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -46,7 +46,7 @@ public abstract class AopContext {
|
||||
* the controlling proxy configuration has been set to "true".
|
||||
* @see ProxyConfig#setExposeProxy
|
||||
*/
|
||||
private static final ThreadLocal currentProxy = new NamedThreadLocal("Current AOP proxy");
|
||||
private static final ThreadLocal<Object> currentProxy = new NamedThreadLocal<Object>("Current AOP proxy");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -123,11 +123,9 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
||||
* @param proxiedInterfaces the interfaces to introspect
|
||||
*/
|
||||
private void findDefinedEqualsAndHashCodeMethods(Class[] proxiedInterfaces) {
|
||||
for (int i = 0; i < proxiedInterfaces.length; i++) {
|
||||
Class proxiedInterface = proxiedInterfaces[i];
|
||||
for (Class proxiedInterface : proxiedInterfaces) {
|
||||
Method[] methods = proxiedInterface.getDeclaredMethods();
|
||||
for (int j = 0; j < methods.length; j++) {
|
||||
Method method = methods[j];
|
||||
for (Method method : methods) {
|
||||
if (AopUtils.isEqualsMethod(method)) {
|
||||
this.equalsDefined = true;
|
||||
}
|
||||
@@ -187,7 +185,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
||||
}
|
||||
|
||||
// Get the interception chain for this method.
|
||||
List chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass);
|
||||
List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass);
|
||||
|
||||
// Check whether we have any advice. If we don't, we can fallback on direct
|
||||
// reflective invocation of the target, and avoid creating a MethodInvocation.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -112,7 +112,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyConfig
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
/** Default value is same as non-ordered */
|
||||
private int order = Integer.MAX_VALUE;
|
||||
private int order = Ordered.LOWEST_PRECEDENCE;
|
||||
|
||||
/** Default is global AdvisorAdapterRegistry */
|
||||
private AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -29,8 +29,8 @@ import org.springframework.core.NamedThreadLocal;
|
||||
public class ProxyCreationContext {
|
||||
|
||||
/** ThreadLocal holding the current proxied bean name during Advisor matching */
|
||||
private static final ThreadLocal currentProxiedBeanName =
|
||||
new NamedThreadLocal("Name of currently proxied bean");
|
||||
private static final ThreadLocal<String> currentProxiedBeanName =
|
||||
new NamedThreadLocal<String>("Name of currently proxied bean");
|
||||
|
||||
|
||||
/**
|
||||
@@ -38,7 +38,7 @@ public class ProxyCreationContext {
|
||||
* @return the name of the bean, or <code>null</code> if none available
|
||||
*/
|
||||
public static String getCurrentProxiedBeanName() {
|
||||
return (String) currentProxiedBeanName.get();
|
||||
return currentProxiedBeanName.get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user