Skip to content

Commit 07920fc

Browse files
committed
polishing
1 parent 87e3277 commit 07920fc

9 files changed

+23
-23
lines changed

org.springframework.aop/src/main/java/org/springframework/aop/TargetClassAware.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public interface TargetClassAware {
3434
* (typically a proxy configuration or an actual proxy).
3535
* @return the target Class, or <code>null</code> if not known
3636
*/
37-
Class getTargetClass();
37+
Class<?> getTargetClass();
3838

3939
}

org.springframework.aop/src/main/java/org/springframework/aop/TargetSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*<
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ public interface TargetSource extends TargetClassAware {
3939
* target class.
4040
* @return the type of targets returned by this {@link TargetSource}
4141
*/
42-
Class getTargetClass();
42+
Class<?> getTargetClass();
4343

4444
/**
4545
* Will all calls to {@link #getTarget()} return the same object?

org.springframework.aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -162,7 +162,7 @@ public void setTargetClass(Class targetClass) {
162162
this.targetSource = EmptyTargetSource.forClass(targetClass);
163163
}
164164

165-
public Class getTargetClass() {
165+
public Class<?> getTargetClass() {
166166
return this.targetSource.getTargetClass();
167167
}
168168

org.springframework.aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,15 +16,12 @@
1616

1717
package org.springframework.aop.target;
1818

19-
import java.io.NotSerializableException;
20-
import java.io.ObjectStreamException;
2119
import java.io.Serializable;
2220

2321
import org.apache.commons.logging.Log;
2422
import org.apache.commons.logging.LogFactory;
2523

2624
import org.springframework.aop.TargetSource;
27-
import org.springframework.beans.BeansException;
2825
import org.springframework.beans.factory.BeanFactory;
2926
import org.springframework.beans.factory.BeanFactoryAware;
3027
import org.springframework.util.ClassUtils;
@@ -65,7 +62,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
6562
private String targetBeanName;
6663

6764
/** Class of the target */
68-
private Class targetClass;
65+
private Class<?> targetClass;
6966

7067
/**
7168
* BeanFactory that owns this TargetSource. We need to hold onto this
@@ -108,7 +105,7 @@ public void setTargetClass(Class targetClass) {
108105
* Set the owning BeanFactory. We need to save a reference so that we can
109106
* use the <code>getBean</code> method on every invocation.
110107
*/
111-
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
108+
public void setBeanFactory(BeanFactory beanFactory) {
112109
if (this.targetBeanName == null) {
113110
throw new IllegalStateException("Property'targetBeanName' is required");
114111
}
@@ -123,15 +120,18 @@ public BeanFactory getBeanFactory() {
123120
}
124121

125122

126-
public synchronized Class getTargetClass() {
123+
public synchronized Class<?> getTargetClass() {
127124
if (this.targetClass == null && this.beanFactory != null) {
128125
// Determine type of the target bean.
129126
this.targetClass = this.beanFactory.getType(this.targetBeanName);
130127
if (this.targetClass == null) {
131128
if (logger.isTraceEnabled()) {
132129
logger.trace("Getting bean with name '" + this.targetBeanName + "' in order to determine type");
133130
}
134-
this.targetClass = this.beanFactory.getBean(this.targetBeanName).getClass();
131+
Object beanInstance = this.beanFactory.getBean(this.targetBeanName);
132+
if (beanInstance != null) {
133+
this.targetClass = beanInstance.getClass();
134+
}
135135
}
136136
}
137137
return this.targetClass;

org.springframework.aop/src/main/java/org/springframework/aop/target/AbstractLazyCreationTargetSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -64,7 +64,7 @@ public synchronized boolean isInitialized() {
6464
* a meaningful value when the target is still <code>null</code>.
6565
* @see #isInitialized()
6666
*/
67-
public synchronized Class getTargetClass() {
67+
public synchronized Class<?> getTargetClass() {
6868
return (this.lazyTarget != null ? this.lazyTarget.getClass() : null);
6969
}
7070

org.springframework.aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -89,7 +89,7 @@ private EmptyTargetSource(Class targetClass, boolean isStatic) {
8989
/**
9090
* Always returns the specified target Class, or <code>null</code> if none.
9191
*/
92-
public Class getTargetClass() {
92+
public Class<?> getTargetClass() {
9393
return this.targetClass;
9494
}
9595

org.springframework.aop/src/main/java/org/springframework/aop/target/HotSwappableTargetSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -59,7 +59,7 @@ public HotSwappableTargetSource(Object initialTarget) {
5959
* Return the type of the current target object.
6060
* <p>The returned type should usually be constant across all target objects.
6161
*/
62-
public synchronized Class getTargetClass() {
62+
public synchronized Class<?> getTargetClass() {
6363
return this.target.getClass();
6464
}
6565

org.springframework.aop/src/main/java/org/springframework/aop/target/SingletonTargetSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ public SingletonTargetSource(Object target) {
5555
}
5656

5757

58-
public Class getTargetClass() {
58+
public Class<?> getTargetClass() {
5959
return this.target.getClass();
6060
}
6161

org.springframework.aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -63,7 +63,7 @@ public void setRefreshCheckDelay(long refreshCheckDelay) {
6363
}
6464

6565

66-
public synchronized Class getTargetClass() {
66+
public synchronized Class<?> getTargetClass() {
6767
if (this.targetObject == null) {
6868
refresh();
6969
}

0 commit comments

Comments
 (0)