Dynamic proxy 動(dòng)態(tài)代理
Befor talking about runtime weaving, let's take a look at Java dynamic proxy.
在說運(yùn)行時(shí)織入之間,我們先看看java動(dòng)態(tài)代理
public class DynamicProxyTest { public interface Vehicle { void whistle(); } public static class Boat implements Vehicle { @Override public void whistle() { System.out.println( "Boat whistle!" ); } } public static class VehicleHandler implements InvocationHandler { private Object proxied; public VehicleHandler(Object proxied ) { this.proxied = proxied; } public Object invoke(Object proxy, Method method, Object[] args ) throws Throwable { checkVehicle(); return meth