SmartproxyJava類動態(tài)代理框架
Smartproxy 是一個 Java 的動態(tài)類和實例代理框架,類似 java.lang.reflect.Proxy 類所作的工作,但無需調(diào)用 InvocationHandler 接口。Smartproxy 通過底層對象提供對抽象類方法的重載。Smartproxy 使用 BCEL 類庫。
示例代碼:
// Create the proxy factory for the set on interface/implementor.
ProxyFactory factory = ProxyFactory.getInstance(SimpleImplementor.class, SimpleInterface.class);
// Creates an underlying object.
SimpleInterface base = new SimpleBaseClass();
// Proxify the underlying object.
SimpleInterface proxified = (SimpleInterface) factory.createProxy(new Object[] { base });
評論
圖片
表情
