Creating Dynamic Proxies

Of all the features of the Reflection API, dynamic proxies are definitely the most esoteric. Dynamic proxies let you create a proxy class that appears to implement one or more interfaces and can serve as a proxy between an object and its clients. Figure 39.3 illustrates how you can insert a proxy between an object and its users.

Figure 39.3. A dynamic proxy can sit between an object and its users.

There are a couple of interesting things to note about dynamic proxies. First, the proxy doesn't need to implement the interface that is being proxied; in fact, the whole reason for the dynamic proxy API is to allow you to proxy ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.