Java 5 code style

This commit is contained in:
Juergen Hoeller
2009-02-05 21:04:13 +00:00
parent 460977263d
commit 92588cddc6
21 changed files with 117 additions and 90 deletions

View File

@@ -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.
@@ -19,6 +19,7 @@ package org.springframework.dao.annotation;
import java.lang.annotation.Annotation;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.AopInfrastructureBean;
import org.springframework.aop.framework.ProxyConfig;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.support.AopUtils;
@@ -74,7 +75,7 @@ public class PersistenceExceptionTranslationPostProcessor extends ProxyConfig
/**
* Set the 'repository' annotation type.
* The default required annotation type is the {@link Repository} annotation.
* The default repository annotation type is the {@link Repository} annotation.
* <p>This setter property exists so that developers can provide their own
* (non-Spring-specific) annotation type to indicate that a class has a
* repository role.
@@ -110,10 +111,14 @@ public class PersistenceExceptionTranslationPostProcessor extends ProxyConfig
}
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
Class<?> targetClass =
(bean instanceof Advised ? ((Advised) bean).getTargetSource().getTargetClass() : bean.getClass());
if (bean instanceof AopInfrastructureBean) {
// Ignore AOP infrastructure such as scoped proxies.
return bean;
}
Class targetClass = AopUtils.getTargetClass(bean);
if (targetClass == null) {
// Can't do much here
// Can't do much here.
return bean;
}

View File

@@ -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.
@@ -66,7 +66,8 @@ public class ConnectionSpecConnectionFactoryAdapter extends DelegatingConnection
private ConnectionSpec connectionSpec;
private final ThreadLocal threadBoundSpec = new NamedThreadLocal("Current CCI ConnectionSpec");
private final ThreadLocal<ConnectionSpec> threadBoundSpec =
new NamedThreadLocal<ConnectionSpec>("Current CCI ConnectionSpec");
/**
@@ -107,7 +108,7 @@ public class ConnectionSpecConnectionFactoryAdapter extends DelegatingConnection
*/
@Override
public final Connection getConnection() throws ResourceException {
ConnectionSpec threadSpec = (ConnectionSpec) this.threadBoundSpec.get();
ConnectionSpec threadSpec = this.threadBoundSpec.get();
if (threadSpec != null) {
return doGetConnection(threadSpec);
}

View File

@@ -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.
@@ -59,8 +59,8 @@ public class ResourceAdapterApplicationContext extends GenericApplicationContext
beanFactory.registerResolvableDependency(BootstrapContext.class, this.bootstrapContext);
// JCA WorkManager resolved lazily - may not be available.
beanFactory.registerResolvableDependency(WorkManager.class, new ObjectFactory() {
public Object getObject() {
beanFactory.registerResolvableDependency(WorkManager.class, new ObjectFactory<WorkManager>() {
public WorkManager getObject() {
return bootstrapContext.getWorkManager();
}
});

View File

@@ -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.
@@ -72,8 +72,8 @@ public abstract class TransactionAspectSupport implements InitializingBean {
* (e.g. before and after advice) if the aspect involves more than a
* single method (as will be the case for around advice).
*/
private static final ThreadLocal transactionInfoHolder =
new NamedThreadLocal("Current aspect-driven transaction");
private static final ThreadLocal<TransactionInfo> transactionInfoHolder =
new NamedThreadLocal<TransactionInfo>("Current aspect-driven transaction");
/**