我想知道当您在创建动态代理实例时调用该newProxyInstance
方法时,参数究竟是什么ClassLoader
?
public static Object newProxyInstance(ClassLoader loader, Class<?>[] interfaces, InvocationHandler h) throws IllegalArgumentException
非常感谢!
PS我不确定如何正确使用代码格式化标签。
我想知道当您在创建动态代理实例时调用该newProxyInstance
方法时,参数究竟是什么ClassLoader
?
public static Object newProxyInstance(ClassLoader loader, Class<?>[] interfaces, InvocationHandler h) throws IllegalArgumentException
非常感谢!
PS我不确定如何正确使用代码格式化标签。
的文档newProxyInstance
定义其用途等同于:
Proxy.getProxyClass(loader, interfaces).
getConstructor(new Class[] { InvocationHandler.class }).
newInstance(new Object[] { handler });
因此,如果您想了解更多关于 . 的详细信息loader
,可以查看getProxyClass
. 基本上,它只是用作定义生成的代理类的类加载器。