Basically, I have a number of objects in my application and I have to convert them to another third party objects before sending the request. On receiving the response I have to convert these objects back to objects supported by my application.
What pattern can I use for converting one model object to another in Java?
I don't think there is a specific pattern for this, but you simply need a "converter" or "translator" class that takes in one object and returns another:
MyObject convert(ThirdPartyObject obj);
ThirdPartyObject convert(MyObject obj);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With