private Object obj;
private long start;
public Object bind(Object obj){
this.obj = obj;
return Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), this);
}
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
start();
method.invoke(obj, args);
before();
return null;
}
public void start(){
System.out.println("start");
start = System.currentTimeMillis();
}
public void before(){
System.out.println("end");
System.out.println(System.currentTimeMillis()-start);
}
}