Converter Pattern

In this post, we will discuss most commonly used Converter Design Pattern in Java/J2EE projects. Thanks to Java 8 features not only provides a way of generic bidirectional conversion between corresponding types but also a common way of converting a collection of objects of the same type, reducing the boilerplate code to the absolute minimum. we have written source code for this pattern using Java 8 features.

Intent

The purpose of the Converter Design Pattern is to provide a generic, common way of bidirectional conversion between corresponding types, allowing a clean implementation in which the types do not need to be aware of each other. Moreover, the Converter Design Pattern introduces bidirectional collection mapping, reducing a boilerplate code to a minimum.

Source code

The Converter Design Pattern is a behavioral design pattern which allows a common way of bidirectional conversion between corresponding types (e.g. DTO and domain representations of the logically isomorphic types). Moreover, the pattern introduces a common way of converting a collection of objects between types.

Comments