Open Credo

3 items found: Search results for "dynamic proxies java" in all categories x

New Tricks With Dynamic Proxies In Java 8 (part 3)

August 18, 2015 | Software Consultancy

New Tricks With Dynamic Proxies In Java 8 (part 3)

In this post, the last in the New Tricks With Dynamic Proxies series (see part 1 and part 2), I’m going to look at using dynamic proxies to create bean-like value objects to represent records. The basic idea here is to have some untyped storage for a collection of property values, such as an array of Objects, and a typed wrapper around that storage which provides a convenient and type-safe access mechanism. A dynamic proxy is used to convert calls on getter and setter methods in the wrapper interface into calls which read and write values in the store.

Read More Read More

New Tricks with Dynamic Proxies in Java 8 (part 2)

July 14, 2015 | Software Consultancy

New Tricks with Dynamic Proxies in Java 8 (part 2)

Building simple proxies

In the previous post I introduced Java dynamic proxies, and sketched out a way they could be used in testing to simplify the generation of custom Hamcrest matchers. In this post, I’m going to dive into some techniques for implementing proxies in Java 8. We’ll start with a simple case, and build up towards something more complex and full-featured.

Read More Read More

New Tricks with Dynamic Proxies in Java 8 (part 1)

July 13, 2015 | Software Consultancy

New Tricks with Dynamic Proxies in Java 8 (part 1)

Why Use Dynamic Proxies?

Dynamic proxies have been a feature of Java since version 1.3. They were widely used in J2EE for remoting. Given an abstract interface, and a concrete implementation of that interface, a call to some method on the interface can be made “remote” (i.e. cross-JVM) by creating two additional classes. The first, a “marshalling” implementation of the interface, captures the details of the call in the source JVM and serializes them over the network. The second, an “unmarshalling” endpoint, receives the serialized call details and dispatches the call to an instance of the concrete class on the target JVM.

Read More Read More