- 第一种:
Class clazzProxy=Proxy.getProxyClass(Collection.class.getClassLoader(), Collection.class);
//得到其有参的构造方法
Constructor con=clazzProxy.getConstructor(InvocationHandler.class);
//创建一个内部类,该类为上面所得方法的的参数类
class MyInvocationHandler implements InvocationHandler{
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
// TODO Auto-generated method stub
return null;
}
}
con.newInstance(new MyInvocationHandler());Class claz