- All Implemented Interfaces:
Invoker
支持的调用程序,这意味着它在从目标提供程序返回的对象上找到匹配的方法并调用它。
该类有助于将现有类调整为它没有实现的接口
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors
-
Method Summary
调用方法
如果在尝试调用方法时出现问题,实现应该抛出异常
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
DuckInvoker
public DuckInvoker(Provider targetProvider)
-
Method Details
-
invoke
Description copied from interface: Invoker
调用方法
如果在尝试调用方法时出现问题,实现应该抛出异常
- Specified by:
invoke in interface Invoker
- Parameters:
proxy - 代理对象
method - 被调用的方法
arguments - 参数
- Returns:
- 返回值
- Throws:
Throwable - 抛出异常