@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -139,7 +139,7 @@ public class AnnotationBeanNameGenerator implements BeanNameGenerator {
|
||||
* <p>The default implementation simply builds a decapitalized version
|
||||
* of the short class name: e.g. "mypackage.MyJdbcDao" -> "myJdbcDao".
|
||||
* <p>Note that inner classes will thus have names of the form
|
||||
* "outerClassName.innerClassName", which because of the period in the
|
||||
* "outerClassName.InnerClassName", which because of the period in the
|
||||
* name may be an issue if you are autowiring by name.
|
||||
* @param definition the bean definition to build a bean name for
|
||||
* @return the default bean name (never {@code null})
|
||||
|
||||
@@ -240,9 +240,8 @@ class ConfigurationClassEnhancer {
|
||||
/**
|
||||
* Enhance a {@link Bean @Bean} method to check the supplied BeanFactory for the
|
||||
* existence of this bean object.
|
||||
* @throws Throwable as a catch-all for any exception that may be thrown when
|
||||
* invoking the super implementation of the proxied method i.e., the actual
|
||||
* {@code @Bean} method.
|
||||
* @throws Throwable as a catch-all for any exception that may be thrown when invoking the
|
||||
* super implementation of the proxied method i.e., the actual {@code @Bean} method
|
||||
*/
|
||||
public Object intercept(Object enhancedConfigInstance, Method beanMethod, Object[] beanMethodArgs,
|
||||
MethodProxy cglibMethodProxy) throws Throwable {
|
||||
|
||||
@@ -227,7 +227,7 @@ public abstract class AbstractApplicationEventMulticaster
|
||||
* for the given event type
|
||||
*/
|
||||
protected boolean supportsEvent(
|
||||
ApplicationListener listener, Class<? extends ApplicationEvent> eventType, Class sourceType) {
|
||||
ApplicationListener listener, Class<? extends ApplicationEvent> eventType, Class<?> sourceType) {
|
||||
|
||||
SmartApplicationListener smartListener = (listener instanceof SmartApplicationListener ?
|
||||
(SmartApplicationListener) listener : new GenericApplicationListenerAdapter(listener));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -107,7 +107,7 @@ public class MBeanClientInterceptor
|
||||
|
||||
private boolean useStrictCasing = true;
|
||||
|
||||
private Class managementInterface;
|
||||
private Class<?> managementInterface;
|
||||
|
||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
@@ -215,7 +215,7 @@ public class MBeanClientInterceptor
|
||||
* setters and getters for MBean attributes and conventional Java methods
|
||||
* for MBean operations.
|
||||
*/
|
||||
public void setManagementInterface(Class managementInterface) {
|
||||
public void setManagementInterface(Class<?> managementInterface) {
|
||||
this.managementInterface = managementInterface;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ public class MBeanClientInterceptor
|
||||
* Return the management interface of the target MBean,
|
||||
* or {@code null} if none specified.
|
||||
*/
|
||||
protected final Class getManagementInterface() {
|
||||
protected final Class<?> getManagementInterface() {
|
||||
return this.managementInterface;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ public class MBeanClientInterceptor
|
||||
this.invocationHandler = null;
|
||||
if (this.useStrictCasing) {
|
||||
// Use the JDK's own MBeanServerInvocationHandler,
|
||||
// in particular for native MXBean support on Java 6.
|
||||
// in particular for native MXBean support on Java 6+.
|
||||
if (JmxUtils.isMXBeanSupportAvailable()) {
|
||||
this.invocationHandler =
|
||||
new MBeanServerInvocationHandler(this.serverToUse, this.objectName,
|
||||
@@ -297,7 +297,7 @@ public class MBeanClientInterceptor
|
||||
MBeanOperationInfo[] operationInfo = info.getOperations();
|
||||
this.allowedOperations = new HashMap<MethodCacheKey, MBeanOperationInfo>(operationInfo.length);
|
||||
for (MBeanOperationInfo infoEle : operationInfo) {
|
||||
Class[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader);
|
||||
Class<?>[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader);
|
||||
this.allowedOperations.put(new MethodCacheKey(infoEle.getName(), paramTypes), infoEle);
|
||||
}
|
||||
}
|
||||
@@ -531,7 +531,7 @@ public class MBeanClientInterceptor
|
||||
* is necessary
|
||||
*/
|
||||
protected Object convertResultValueIfNecessary(Object result, MethodParameter parameter) {
|
||||
Class targetClass = parameter.getParameterType();
|
||||
Class<?> targetClass = parameter.getParameterType();
|
||||
try {
|
||||
if (result == null) {
|
||||
return null;
|
||||
@@ -549,7 +549,7 @@ public class MBeanClientInterceptor
|
||||
return convertDataArrayToTargetArray(array, targetClass);
|
||||
}
|
||||
else if (Collection.class.isAssignableFrom(targetClass)) {
|
||||
Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
|
||||
Class<?> elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
|
||||
if (elementType != null) {
|
||||
return convertDataArrayToTargetCollection(array, targetClass, elementType);
|
||||
}
|
||||
@@ -565,7 +565,7 @@ public class MBeanClientInterceptor
|
||||
return convertDataArrayToTargetArray(array, targetClass);
|
||||
}
|
||||
else if (Collection.class.isAssignableFrom(targetClass)) {
|
||||
Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
|
||||
Class<?> elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
|
||||
if (elementType != null) {
|
||||
return convertDataArrayToTargetCollection(array, targetClass, elementType);
|
||||
}
|
||||
@@ -581,8 +581,8 @@ public class MBeanClientInterceptor
|
||||
}
|
||||
}
|
||||
|
||||
private Object convertDataArrayToTargetArray(Object[] array, Class targetClass) throws NoSuchMethodException {
|
||||
Class targetType = targetClass.getComponentType();
|
||||
private Object convertDataArrayToTargetArray(Object[] array, Class<?> targetClass) throws NoSuchMethodException {
|
||||
Class<?> targetType = targetClass.getComponentType();
|
||||
Method fromMethod = targetType.getMethod("from", array.getClass().getComponentType());
|
||||
Object resultArray = Array.newInstance(targetType, array.length);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
@@ -592,11 +592,11 @@ public class MBeanClientInterceptor
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Collection convertDataArrayToTargetCollection(Object[] array, Class collectionType, Class elementType)
|
||||
private Collection<?> convertDataArrayToTargetCollection(Object[] array, Class<?> collectionType, Class<?> elementType)
|
||||
throws NoSuchMethodException {
|
||||
|
||||
Method fromMethod = elementType.getMethod("from", array.getClass().getComponentType());
|
||||
Collection resultColl = CollectionFactory.createCollection(collectionType, Array.getLength(array));
|
||||
Collection<Object> resultColl = CollectionFactory.createCollection(collectionType, Array.getLength(array));
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
resultColl.add(ReflectionUtils.invokeMethod(fromMethod, null, array[i]));
|
||||
}
|
||||
@@ -608,6 +608,7 @@ public class MBeanClientInterceptor
|
||||
this.connector.close();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple wrapper class around a method name and its signature.
|
||||
* Used as the key when caching methods.
|
||||
@@ -616,7 +617,7 @@ public class MBeanClientInterceptor
|
||||
|
||||
private final String name;
|
||||
|
||||
private final Class[] parameterTypes;
|
||||
private final Class<?>[] parameterTypes;
|
||||
|
||||
/**
|
||||
* Create a new instance of {@code MethodCacheKey} with the supplied
|
||||
@@ -624,9 +625,9 @@ public class MBeanClientInterceptor
|
||||
* @param name the name of the method
|
||||
* @param parameterTypes the arguments in the method signature
|
||||
*/
|
||||
public MethodCacheKey(String name, Class[] parameterTypes) {
|
||||
public MethodCacheKey(String name, Class<?>[] parameterTypes) {
|
||||
this.name = name;
|
||||
this.parameterTypes = (parameterTypes != null ? parameterTypes : new Class[0]);
|
||||
this.parameterTypes = (parameterTypes != null ? parameterTypes : new Class<?>[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -145,7 +145,7 @@ public abstract class JmxUtils {
|
||||
* @return the parameter types as classes
|
||||
* @throws ClassNotFoundException if a parameter type could not be resolved
|
||||
*/
|
||||
public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClassNotFoundException {
|
||||
public static Class<?>[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClassNotFoundException {
|
||||
return parameterInfoToTypes(paramInfo, ClassUtils.getDefaultClassLoader());
|
||||
}
|
||||
|
||||
@@ -157,12 +157,12 @@ public abstract class JmxUtils {
|
||||
* @return the parameter types as classes
|
||||
* @throws ClassNotFoundException if a parameter type could not be resolved
|
||||
*/
|
||||
public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, ClassLoader classLoader)
|
||||
public static Class<?>[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, ClassLoader classLoader)
|
||||
throws ClassNotFoundException {
|
||||
|
||||
Class[] types = null;
|
||||
Class<?>[] types = null;
|
||||
if (paramInfo != null && paramInfo.length > 0) {
|
||||
types = new Class[paramInfo.length];
|
||||
types = new Class<?>[paramInfo.length];
|
||||
for (int x = 0; x < paramInfo.length; x++) {
|
||||
types[x] = ClassUtils.forName(paramInfo[x].getType(), classLoader);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ public abstract class JmxUtils {
|
||||
* @return the signature as array of argument types
|
||||
*/
|
||||
public static String[] getMethodSignature(Method method) {
|
||||
Class[] types = method.getParameterTypes();
|
||||
Class<?>[] types = method.getParameterTypes();
|
||||
String[] signature = new String[types.length];
|
||||
for (int x = 0; x < types.length; x++) {
|
||||
signature[x] = types[x].getName();
|
||||
@@ -282,7 +282,7 @@ public abstract class JmxUtils {
|
||||
return null;
|
||||
}
|
||||
String mbeanInterfaceName = clazz.getName() + MBEAN_SUFFIX;
|
||||
Class[] implementedInterfaces = clazz.getInterfaces();
|
||||
Class<?>[] implementedInterfaces = clazz.getInterfaces();
|
||||
for (Class<?> iface : implementedInterfaces) {
|
||||
if (iface.getName().equals(mbeanInterfaceName)) {
|
||||
return iface;
|
||||
@@ -302,7 +302,7 @@ public abstract class JmxUtils {
|
||||
if (clazz == null || clazz.getSuperclass() == null) {
|
||||
return null;
|
||||
}
|
||||
Class[] implementedInterfaces = clazz.getInterfaces();
|
||||
Class<?>[] implementedInterfaces = clazz.getInterfaces();
|
||||
for (Class<?> iface : implementedInterfaces) {
|
||||
boolean isMxBean = iface.getName().endsWith(MXBEAN_SUFFIX);
|
||||
if (mxBeanAnnotationAvailable) {
|
||||
|
||||
Reference in New Issue
Block a user