Consistent use of Class<?>
This commit is contained in:
parent
e812b6cea0
commit
091712df06
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2013 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.
|
||||||
|
@ -52,13 +52,13 @@ public interface Advised extends TargetClassAware {
|
||||||
* Return the interfaces proxied by the AOP proxy. Will not
|
* Return the interfaces proxied by the AOP proxy. Will not
|
||||||
* include the target class, which may also be proxied.
|
* include the target class, which may also be proxied.
|
||||||
*/
|
*/
|
||||||
Class[] getProxiedInterfaces();
|
Class<?>[] getProxiedInterfaces();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether the given interface is proxied.
|
* Determine whether the given interface is proxied.
|
||||||
* @param intf the interface to check
|
* @param intf the interface to check
|
||||||
*/
|
*/
|
||||||
boolean isInterfaceProxied(Class intf);
|
boolean isInterfaceProxied(Class<?> intf);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||||
* @see #setTargetSource
|
* @see #setTargetSource
|
||||||
* @see #setTarget
|
* @see #setTarget
|
||||||
*/
|
*/
|
||||||
public void setTargetClass(Class targetClass) {
|
public void setTargetClass(Class<?> targetClass) {
|
||||||
this.targetSource = EmptyTargetSource.forClass(targetClass);
|
this.targetSource = EmptyTargetSource.forClass(targetClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||||
/**
|
/**
|
||||||
* Set the interfaces to be proxied.
|
* Set the interfaces to be proxied.
|
||||||
*/
|
*/
|
||||||
public void setInterfaces(Class[] interfaces) {
|
public void setInterfaces(Class<?>... interfaces) {
|
||||||
Assert.notNull(interfaces, "Interfaces must not be null");
|
Assert.notNull(interfaces, "Interfaces must not be null");
|
||||||
this.interfaces.clear();
|
this.interfaces.clear();
|
||||||
for (Class ifc : interfaces) {
|
for (Class ifc : interfaces) {
|
||||||
|
@ -211,7 +211,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||||
* Add a new proxied interface.
|
* Add a new proxied interface.
|
||||||
* @param intf the additional interface to proxy
|
* @param intf the additional interface to proxy
|
||||||
*/
|
*/
|
||||||
public void addInterface(Class intf) {
|
public void addInterface(Class<?> intf) {
|
||||||
Assert.notNull(intf, "Interface must not be null");
|
Assert.notNull(intf, "Interface must not be null");
|
||||||
if (!intf.isInterface()) {
|
if (!intf.isInterface()) {
|
||||||
throw new IllegalArgumentException("[" + intf.getName() + "] is not an interface");
|
throw new IllegalArgumentException("[" + intf.getName() + "] is not an interface");
|
||||||
|
@ -229,17 +229,17 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||||
* @return {@code true} if the interface was removed; {@code false}
|
* @return {@code true} if the interface was removed; {@code false}
|
||||||
* if the interface was not found and hence could not be removed
|
* if the interface was not found and hence could not be removed
|
||||||
*/
|
*/
|
||||||
public boolean removeInterface(Class intf) {
|
public boolean removeInterface(Class<?> intf) {
|
||||||
return this.interfaces.remove(intf);
|
return this.interfaces.remove(intf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class[] getProxiedInterfaces() {
|
public Class<?>[] getProxiedInterfaces() {
|
||||||
return this.interfaces.toArray(new Class[this.interfaces.size()]);
|
return this.interfaces.toArray(new Class[this.interfaces.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInterfaceProxied(Class intf) {
|
public boolean isInterfaceProxied(Class<?> intf) {
|
||||||
for (Class proxyIntf : this.interfaces) {
|
for (Class proxyIntf : this.interfaces) {
|
||||||
if (intf.isAssignableFrom(proxyIntf)) {
|
if (intf.isAssignableFrom(proxyIntf)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2013 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.
|
||||||
|
@ -57,7 +57,7 @@ public class ProxyFactory extends ProxyCreatorSupport {
|
||||||
* <p>No target, only interfaces. Must add interceptors.
|
* <p>No target, only interfaces. Must add interceptors.
|
||||||
* @param proxyInterfaces the interfaces that the proxy should implement
|
* @param proxyInterfaces the interfaces that the proxy should implement
|
||||||
*/
|
*/
|
||||||
public ProxyFactory(Class[] proxyInterfaces) {
|
public ProxyFactory(Class<?>... proxyInterfaces) {
|
||||||
setInterfaces(proxyInterfaces);
|
setInterfaces(proxyInterfaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class ProxyFactory extends ProxyCreatorSupport {
|
||||||
* @param proxyInterface the interface that the proxy should implement
|
* @param proxyInterface the interface that the proxy should implement
|
||||||
* @param interceptor the interceptor that the proxy should invoke
|
* @param interceptor the interceptor that the proxy should invoke
|
||||||
*/
|
*/
|
||||||
public ProxyFactory(Class proxyInterface, Interceptor interceptor) {
|
public ProxyFactory(Class<?> proxyInterface, Interceptor interceptor) {
|
||||||
addInterface(proxyInterface);
|
addInterface(proxyInterface);
|
||||||
addAdvice(interceptor);
|
addAdvice(interceptor);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public class ProxyFactory extends ProxyCreatorSupport {
|
||||||
* @param proxyInterface the interface that the proxy should implement
|
* @param proxyInterface the interface that the proxy should implement
|
||||||
* @param targetSource the TargetSource that the proxy should invoke
|
* @param targetSource the TargetSource that the proxy should invoke
|
||||||
*/
|
*/
|
||||||
public ProxyFactory(Class proxyInterface, TargetSource targetSource) {
|
public ProxyFactory(Class<?> proxyInterface, TargetSource targetSource) {
|
||||||
addInterface(proxyInterface);
|
addInterface(proxyInterface);
|
||||||
setTargetSource(targetSource);
|
setTargetSource(targetSource);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2013 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.
|
||||||
|
@ -48,14 +48,14 @@ public class InjectionMetadata {
|
||||||
|
|
||||||
private final Log logger = LogFactory.getLog(InjectionMetadata.class);
|
private final Log logger = LogFactory.getLog(InjectionMetadata.class);
|
||||||
|
|
||||||
private final Class targetClass;
|
private final Class<?> targetClass;
|
||||||
|
|
||||||
private final Collection<InjectedElement> injectedElements;
|
private final Collection<InjectedElement> injectedElements;
|
||||||
|
|
||||||
private volatile Set<InjectedElement> checkedElements;
|
private volatile Set<InjectedElement> checkedElements;
|
||||||
|
|
||||||
|
|
||||||
public InjectionMetadata(Class targetClass, Collection<InjectedElement> elements) {
|
public InjectionMetadata(Class<?> targetClass, Collection<InjectedElement> elements) {
|
||||||
this.targetClass = targetClass;
|
this.targetClass = targetClass;
|
||||||
this.injectedElements = elements;
|
this.injectedElements = elements;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public class InjectionMetadata {
|
||||||
return this.member;
|
return this.member;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Class getResourceType() {
|
protected final Class<?> getResourceType() {
|
||||||
if (this.isField) {
|
if (this.isField) {
|
||||||
return ((Field) this.member).getType();
|
return ((Field) this.member).getType();
|
||||||
}
|
}
|
||||||
|
@ -122,16 +122,16 @@ public class InjectionMetadata {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void checkResourceType(Class resourceType) {
|
protected final void checkResourceType(Class<?> resourceType) {
|
||||||
if (this.isField) {
|
if (this.isField) {
|
||||||
Class fieldType = ((Field) this.member).getType();
|
Class<?> fieldType = ((Field) this.member).getType();
|
||||||
if (!(resourceType.isAssignableFrom(fieldType) || fieldType.isAssignableFrom(resourceType))) {
|
if (!(resourceType.isAssignableFrom(fieldType) || fieldType.isAssignableFrom(resourceType))) {
|
||||||
throw new IllegalStateException("Specified field type [" + fieldType +
|
throw new IllegalStateException("Specified field type [" + fieldType +
|
||||||
"] is incompatible with resource type [" + resourceType.getName() + "]");
|
"] is incompatible with resource type [" + resourceType.getName() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Class paramType =
|
Class<?> paramType =
|
||||||
(this.pd != null ? this.pd.getPropertyType() : ((Method) this.member).getParameterTypes()[0]);
|
(this.pd != null ? this.pd.getPropertyType() : ((Method) this.member).getParameterTypes()[0]);
|
||||||
if (!(resourceType.isAssignableFrom(paramType) || paramType.isAssignableFrom(resourceType))) {
|
if (!(resourceType.isAssignableFrom(paramType) || paramType.isAssignableFrom(resourceType))) {
|
||||||
throw new IllegalStateException("Specified parameter type [" + paramType +
|
throw new IllegalStateException("Specified parameter type [" + paramType +
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2013 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.
|
||||||
|
@ -44,7 +44,7 @@ public class DependencyDescriptor implements Serializable {
|
||||||
|
|
||||||
private transient Field field;
|
private transient Field field;
|
||||||
|
|
||||||
private Class declaringClass;
|
private Class<?> declaringClass;
|
||||||
|
|
||||||
private String methodName;
|
private String methodName;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue