SmartproxyJava类动态代理框架

联合创作 · 2023-09-28 20:48

Smartproxy 是一个 Java 的动态类和实例代理框架,类似 java.lang.reflect.Proxy 类所作的工作,但无需调用 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 });

浏览 7
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报