Nanning Aspects

授权协议 Apache
开发语言 Java
所属分类 程序开发、 面向方面AOP/IoC
软件类型 开源软件
地区 不详
投 递 者 翟冷勋
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

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();