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)
| 92 | |
| 93 | |
| 94 | public static <T> T newProxy(Class<T> interfaceType, InvocationHandler handler) { |
| 95 | checkNotNull(handler); |
| 96 | checkArgument(interfaceType.isInterface(), "%s is not an interface", interfaceType); |
| 97 | Object object = Proxy.newProxyInstance(interfaceType.getClassLoader(), new Class<?>[] {interfaceType}, handler); |
| 98 | return interfaceType.cast(object); |
| 99 | } |
| 100 | |
| 101 | private Reflection() {} |
| 102 | } |
no test coverage detected