看评论大家对PROXY 究竟是什么,说法不一。如果是被代理对象,那就是通过构造函数传进来的,如果是代理对象,那么它是怎么来的呢?
2017-06-22
作业答案
InvocationHandler invocationHandler2=new LogHandler(moveable);
Class<?> class2 = moveable.getClass();
Moveable moveable2 =(Moveable)Proxy.newProxyInstance(class2.getClassLoader(), class2.getInterfaces(), invocationHandler2);
moveable2.move();
InvocationHandler invocationHandler2=new LogHandler(moveable);
Class<?> class2 = moveable.getClass();
Moveable moveable2 =(Moveable)Proxy.newProxyInstance(class2.getClassLoader(), class2.getInterfaces(), invocationHandler2);
moveable2.move();
2017-06-19