background preloader

Project Lombok

Project Lombok

Dynamic Proxies Dynamic proxies provide an alternate, dynamic mechanism for implementing many common design patterns, including the Facade, Bridge, Interceptor, Decorator, Proxy (including remote and virtual proxies), and Adapter patterns. While all of these patterns can be easily implemented using ordinary classes instead of dynamic proxies, in many cases the dynamic proxy approach is more convenient and compact and can eliminate a lot of handwritten or generated classes. The Proxy pattern The Proxy pattern involves the creation of a "stub" or "surrogate" object, whose purpose is to accept requests and forward them to another object that actually does the work. In JDKs prior to 5.0, RMI stubs (and their counterpart, skeletons) were classes generated at compile time by the RMI compiler (rmic), which is part of the JDK tool set. Back to top The dynamic proxy mechanism At the heart of the dynamic proxy mechanism is the InvocationHandler interface, shown in Listing 1. Listing 1. Listing 2. Listing 3.

Op4j jOOQ is a fluent API for typesafe SQL query Guava

Related: