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

uncle.proxy.ProxyManager Maven / Gradle / Ivy

package uncle.proxy;

import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;
import java.util.List;

/**
 * Created by hujianbo on 2018/1/19.
 */
public class ProxyManager {
    public static  T createProxy(final Class targetClass, final List proxyList){
        return (T) Enhancer.create(targetClass, new MethodInterceptor() {
            public Object intercept(Object targetObject, Method targetMethod, Object[] methodParams, MethodProxy methodProxy) throws Throwable {
                return new ProxyChain(targetClass,targetObject,targetMethod,methodProxy,methodParams,proxyList).doProxyChain();
            }
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy