/** * Method instance on proxies that come from a classloader outside * the bean's classloader need to be swapped out for the identical * method in the bean's classloader. * * @param method Method * @return return's the same method but loaded from the beans classloader */ private Method copyMethod(final Method method) throws Exception { final int parameterCount = method.getParameterTypes().length; Class[] types = new Class[1 + parameterCount]; types[0] = method.getDeclaringClass(); System.arraycopy(method.getParameterTypes(), 0, types, 1, parameterCount); types = (Class[]) copyArgs(types); final Class targetClass = types[0]; final Class[] targetParameters = new Class[parameterCount]; System.arraycopy(types, 1, targetParameters, 0, parameterCount); return targetClass.getMethod(method.getName(), targetParameters); }
/** * Method instance on proxies that come from a classloader outside * the bean's classloader need to be swapped out for the identical * method in the bean's classloader. * * @param method Method * @return return's the same method but loaded from the beans classloader */ private Method copyMethod(final Method method) throws Exception { final int parameterCount = method.getParameterTypes().length; Class[] types = new Class[1 + parameterCount]; types[0] = method.getDeclaringClass(); System.arraycopy(method.getParameterTypes(), 0, types, 1, parameterCount); types = (Class[]) copyArgs(types); final Class targetClass = types[0]; final Class[] targetParameters = new Class[parameterCount]; System.arraycopy(types, 1, targetParameters, 0, parameterCount); return targetClass.getMethod(method.getName(), targetParameters); }
/** * Method instance on proxies that come from a classloader outside * the bean's classloader need to be swapped out for the identical * method in the bean's classloader. * * @param method * @return return's the same method but loaded from the beans classloader */ private Method copyMethod(Method method) throws Exception { int parameterCount = method.getParameterTypes().length; Object[] types = new Object[1 + parameterCount]; types[0] = method.getDeclaringClass(); System.arraycopy(method.getParameterTypes(), 0, types, 1, parameterCount); types = copyArgs(types); Class targetClass = (Class) types[0]; Class[] targetParameters = new Class[parameterCount]; System.arraycopy(types, 1, targetParameters, 0, parameterCount); Method targetMethod = targetClass.getMethod(method.getName(), targetParameters); return targetMethod; }