A
A
allienn2021-09-20 19:52:22
Java
allienn, 2021-09-20 19:52:22

What are the libraries for converting data from one structure to another?

Colleagues, good afternoon! There is such a task: it is necessary to implement logic that can compare data of different structures to each other.

That is, suppose we have the following data structures defined:

Structure 1:
Order class, it has the Cost property
Customer class, it has the properties Name and the Orders collection

Structure 2:
Name1 -
Cost1 Name1 - Cost2 Name1 -
Cost3
....
Name1 - CostN It is

necessary to set a rule for converting structure 2 into structure 1
That is, at the output we get a Client with a Name and a collection of Orders

These structures are just an example, structures can be wider, nested and much more interesting

I'm sure that someone has already explicitly solved similar problems

Maybe someone will suggest libraries/frameworks that can:
1. Describe/configure such transformations
2. Implement them. We give one data set at the input, at the output we get the second one, converted according to the rule

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-09-20
@allienne

https://mapstruct.org

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question