Nanning Aspects 介绍
Nanning Aspects 是一个简单的可扩展的面向方面的 Java 框架。
示例代码:
Method method = Interface.class.getMethod("call", null); AspectInstance aspectInstance = new AspectInstance(); Mixin mixin = new Mixin(Interface.class, new Target()); mixin.addInterceptor(method, new MethodInterceptor() { public void invoke(Invocation invocation) { System.out.println("Hello world from an interceptor on " + invocation.getMethod()); Object result = invocation.invokeNext(); // passes call on to next interceptor or target return result: // result will be passed on to the caller as the return value of the call } }); aspectInstance.addMixin(mixin); Interface proxy = (Interface) aspectInstance.getProxy(); proxy.call();
Nanning Aspects 官网
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。