All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sky.cglib.proxy.MethodProxyExecuter Maven / Gradle / Ivy

The newest version!
package sky.cglib.proxy;

import java.lang.reflect.Method;

public class MethodProxyExecuter {

	@SuppressWarnings({ "rawtypes" }) public static Object executeInterceptor(MethodInterceptor interceptor, Class superClass, String methodName, Class[] argsType, Object[] argsValue, Object object) {
		if (interceptor == null) {
			throw new ProxyException("Did not set method interceptor !");
		}
		try {
			return interceptor.intercept(methodName, argsType, argsValue);
		} catch (Exception e) {
			throw new ProxyException(e.getMessage());
		}
	}

	@SuppressWarnings({ "unchecked", "rawtypes" }) public static Object executeMethod(Class subClass, String methodName, Class[] argsType, Object[] argsValue, Object object) {
		try {
			Method method = subClass.getDeclaredMethod(methodName + Const.SUBCLASS_INVOKE_SUPER_SUFFIX, argsType);
			return method.invoke(object, argsValue);
		} catch (Exception e) {
			throw new ProxyException(e.getMessage());
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy