JDK动态代理 如何叠加求解
JDK动态代理 如何叠加求解!最好代理参考下
JDK动态代理 如何叠加求解!最好代理参考下
2016-03-01
Car car = new Car();
InvocationHandler timeHandler = new TimeHandler(car);
Movable movable1 = (Movable)Proxy.newProxyInstance(car.getClass().getClassLoader(), car.getClass().getInterfaces(), timeHandler);
InvocationHandler logHandler = new LogHandler(movable1);
Movable movable2 = (Movable)Proxy.newProxyInstance(movable1.getClass().getClassLoader(), movable1.getClass().getInterfaces(), logHandler);
movable2.move();
举报