new InvocationHandler() {
private final Platform platform = Platform.get();
@Override public Object invoke(Object proxy, Method method, Object... args)
throws Throwable {
// 可以在这里写一些核心业务之前的方法
System.out.print("you can do something before you business");
Object result =
method.invoke(this, args);
// 可以在这里写一些核心业务之前的方法
System.out.print("you can do something after you business"); return result; }
});invoke(Object proxy,Method method,Object... args)三个参数分别代表的意思是:proxy:指代我们所代理的那个真实对象method:指代我们所要调用真实对象的某个方法的Method对象args:指代我们调用某个真实方法时接受的参数运行先后顺序如下:You can do something here before process your business核心业务method...You can do something here after process your business
新闻热点
疑难解答