阅读背景:

创建代理类实例的三种方法

来源:互联网 

  • 第一种:
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



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: