在第二章jdk动态代理中 要实现多事物的处理处理,测试类要如何编写?
CarSimp car = new CarSimp();
InvocationHandler handlerTime = new TimeHandler(car);
Class classCar = car.getClass();
Moveable mTime = (Moveable) Proxy.newProxyInstance(classCar.getClassLoader(), classCar.getInterfaces(), handlerTime);
mTime.move();
//上面的只是实现了时间的处理 如何也实现 日志处理?
InvocationHandler handlerLog = new LogHandler(handlerTime);
Moveable mLog = (Moveable) Proxy.newProxyInstance(classCar.getClassLoader(),classCar.getInterfaces(),handlerLog);