作者回复: 是的,动态代理让用户API调用透明
作者回复: 相比于其他框架,其API还是很简单的。举个例子:Class<? extends T> clazz = BYTE_BUDDY.subclass(clz)
.method(ElementMatchers.isDeclaredBy(clz))
.intercept(MethodDelegation.to(new ByteBuddyInvocationHandler(invoker)))
.make()
.load(classLoader, ClassLoadingStrategy.Default.INJECTION)
.getLoaded();
try {
return clazz.newInstance();
} catch (Exception e) {
throw new ProxyException("Error occurred while creating bytebuddy proxy of " + clz.getName(), e);
}