Returns a proxy instance that implements interfaceType by dispatching method invocations to handler. The class loader of interfaceType will be used to define the proxy class. To implement multiple interfaces or specify a class loader, use Proxy#newProxyInstance. @thr
(Class<T> interfaceType, InvocationHandler handler)
| 80 | * interface |
| 81 | */ |
| 82 | public static <T> T newProxy(Class<T> interfaceType, InvocationHandler handler) { |
| 83 | checkNotNull(handler); |
| 84 | checkArgument(interfaceType.isInterface(), "%s is not an interface", interfaceType); |
| 85 | Object object = |
| 86 | Proxy.newProxyInstance( |
| 87 | interfaceType.getClassLoader(), new Class<?>[] {interfaceType}, handler); |
| 88 | return interfaceType.cast(object); |
| 89 | } |
| 90 | |
| 91 | private Reflection() {} |
| 92 | } |
no test coverage detected