September 2019
Intermediate to advanced
816 pages
18h 47m
English
For example, let's write a dynamic proxy that counts the number of invocations of the methods of List.
A dynamic proxy is created via the Proxy.newProxyInstance() method. The newProxyInstance() methods takes three parameters:
Check out this example:
List<String> listProxy = (List<String>) Proxy.newProxyInstance( List.class.getClassLoader(), new Class[] { List.class}, invocationHandler);
This snippet of code returns a dynamic implementation of the List interface. Further, all invocations via this proxy will be dispatched ...