polishing

This commit is contained in:
Juergen Hoeller 2010-04-22 21:37:35 +00:00
parent 87e327773e
commit 07920fc3df
9 changed files with 23 additions and 23 deletions

View File

@ -34,6 +34,6 @@ public interface TargetClassAware {
* (typically a proxy configuration or an actual proxy). * (typically a proxy configuration or an actual proxy).
* @return the target Class, or <code>null</code> if not known * @return the target Class, or <code>null</code> if not known
*/ */
Class getTargetClass(); Class<?> getTargetClass();
} }

View File

@ -1,5 +1,5 @@
/*< /*<
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -39,7 +39,7 @@ public interface TargetSource extends TargetClassAware {
* target class. * target class.
* @return the type of targets returned by this {@link TargetSource} * @return the type of targets returned by this {@link TargetSource}
*/ */
Class getTargetClass(); Class<?> getTargetClass();
/** /**
* Will all calls to {@link #getTarget()} return the same object? * Will all calls to {@link #getTarget()} return the same object?

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -162,7 +162,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
this.targetSource = EmptyTargetSource.forClass(targetClass); this.targetSource = EmptyTargetSource.forClass(targetClass);
} }
public Class getTargetClass() { public Class<?> getTargetClass() {
return this.targetSource.getTargetClass(); return this.targetSource.getTargetClass();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,15 +16,12 @@
package org.springframework.aop.target; package org.springframework.aop.target;
import java.io.NotSerializableException;
import java.io.ObjectStreamException;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.aop.TargetSource; import org.springframework.aop.TargetSource;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
@ -65,7 +62,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
private String targetBeanName; private String targetBeanName;
/** Class of the target */ /** Class of the target */
private Class targetClass; private Class<?> targetClass;
/** /**
* BeanFactory that owns this TargetSource. We need to hold onto this * BeanFactory that owns this TargetSource. We need to hold onto this
@ -108,7 +105,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
* Set the owning BeanFactory. We need to save a reference so that we can * Set the owning BeanFactory. We need to save a reference so that we can
* use the <code>getBean</code> method on every invocation. * use the <code>getBean</code> method on every invocation.
*/ */
public void setBeanFactory(BeanFactory beanFactory) throws BeansException { public void setBeanFactory(BeanFactory beanFactory) {
if (this.targetBeanName == null) { if (this.targetBeanName == null) {
throw new IllegalStateException("Property'targetBeanName' is required"); throw new IllegalStateException("Property'targetBeanName' is required");
} }
@ -123,7 +120,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
} }
public synchronized Class getTargetClass() { public synchronized Class<?> getTargetClass() {
if (this.targetClass == null && this.beanFactory != null) { if (this.targetClass == null && this.beanFactory != null) {
// Determine type of the target bean. // Determine type of the target bean.
this.targetClass = this.beanFactory.getType(this.targetBeanName); this.targetClass = this.beanFactory.getType(this.targetBeanName);
@ -131,7 +128,10 @@ public abstract class AbstractBeanFactoryBasedTargetSource
if (logger.isTraceEnabled()) { if (logger.isTraceEnabled()) {
logger.trace("Getting bean with name '" + this.targetBeanName + "' in order to determine type"); logger.trace("Getting bean with name '" + this.targetBeanName + "' in order to determine type");
} }
this.targetClass = this.beanFactory.getBean(this.targetBeanName).getClass(); Object beanInstance = this.beanFactory.getBean(this.targetBeanName);
if (beanInstance != null) {
this.targetClass = beanInstance.getClass();
}
} }
} }
return this.targetClass; return this.targetClass;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -64,7 +64,7 @@ public abstract class AbstractLazyCreationTargetSource implements TargetSource {
* a meaningful value when the target is still <code>null</code>. * a meaningful value when the target is still <code>null</code>.
* @see #isInitialized() * @see #isInitialized()
*/ */
public synchronized Class getTargetClass() { public synchronized Class<?> getTargetClass() {
return (this.lazyTarget != null ? this.lazyTarget.getClass() : null); return (this.lazyTarget != null ? this.lazyTarget.getClass() : null);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -89,7 +89,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
/** /**
* Always returns the specified target Class, or <code>null</code> if none. * Always returns the specified target Class, or <code>null</code> if none.
*/ */
public Class getTargetClass() { public Class<?> getTargetClass() {
return this.targetClass; return this.targetClass;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -59,7 +59,7 @@ public class HotSwappableTargetSource implements TargetSource, Serializable {
* Return the type of the current target object. * Return the type of the current target object.
* <p>The returned type should usually be constant across all target objects. * <p>The returned type should usually be constant across all target objects.
*/ */
public synchronized Class getTargetClass() { public synchronized Class<?> getTargetClass() {
return this.target.getClass(); return this.target.getClass();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -55,7 +55,7 @@ public class SingletonTargetSource implements TargetSource, Serializable {
} }
public Class getTargetClass() { public Class<?> getTargetClass() {
return this.target.getClass(); return this.target.getClass();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -63,7 +63,7 @@ public abstract class AbstractRefreshableTargetSource implements TargetSource, R
} }
public synchronized Class getTargetClass() { public synchronized Class<?> getTargetClass() {
if (this.targetObject == null) { if (this.targetObject == null) {
refresh(); refresh();
} }