- 授权协议: 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());
}
The Smashing Book
Jacob Gube、Dmitry Fadeev、Chris Spooner、Darius A Monsef IV、Alessandro Cattaneo、Steven Snell、David Leggett、Andrew Maier、Kayla Knight、Yves Peters、René Schmidt、Smashing Magazine editorial team、Vitaly Friedman、Sven Lennartz / 2009 / $ 29.90 / € 23.90
The Smashing Book is a printed book about best practices in modern Web design. The book shares technical tips and best practices on coding, usability and optimization and explores how to create succes......一起来看看 《The Smashing Book》 这本书的介绍吧!
