- 授权协议: Apache
- 开发语言: Java
- 操作系统: 跨平台
- 软件首页: https://github.com/verhas/djcproxy
- 软件文档: https://github.com/verhas/djcproxy
软件介绍
djcproxy 是一个小型的 Java 库,实现动态 Java 类代理。使用它可以在运行时对已存在的对象创建代理对象,用来创建面向方面特性。例如度量某个方法的执行时间,修改方法行为,记录方法执行等等。
完整示例代码:
protected static class A {
public A() {
}
public int method() {
return 1;
}
}
private class Interceptor implements MethodInterceptor {
@Override
public Object intercept(Object obj, Method method, Object[] args)
throws Exception {
if (method.getName().equals("toString")) {
return "interceptedToString";
}
return 0;
}
}
@Test
public void given_Object_when_CreatingSource_then_GettingInterceptorResult()
throws Exception {
A a = new A();
ProxyFactory<A> factory = new ProxyFactory<>();
A s = factory.create(a, new Interceptor());
Assert.assertEquals("interceptedToString", s.toString());
Assert.assertEquals(0, s.method());
}
数据结构与算法分析
维斯 / 人民邮电 / 2006-10 / 59.00元
《数据结构与算法分析:C++描述》秉承Weiss著全一贯的严谨风格,同时又突出了实践。书中充分应用了现代C++语言特性,透彻地讲述了数据结构的原理和应用,不仅使学生具备算法分析能力,能够开发高效的程序,而且让学生掌握良好的程序设计技巧。一起来看看 《数据结构与算法分析》 这本书的介绍吧!
