I'm creating a REST service, which works as a proxy, but exposes own model.
So, I'm using dozer to map my object model to remote service object model.
To make my service returning only requested information I added additional "fields" param,
which specifies what properties are requested.
For example, if REST service returns you an Object with 2 fields:
Person {
firstName,
lastName,
}
it should be possible to request Person object with just firstName property like:
GET Person, fields = Person.firstName.
So, here the question - it is clear how to get object from remote service, transform it to my model and return back. But it is totally unclear for me how to transform my Fields (based on my object graph) to a remote fields list. Is it possible to use dozer to solve this problem? It already contains all mappings internally, so theoretically it should be possible.
Example:
Suppose i have my object :
Person {firstName, lastName}
and remote model has:
Human{name, surname}
Requested fields could be: "Person.lastName, Person.firstName"
And the question is - is it possible to use dozer to transform this String into:
"Human.name, Human.surname"
And if yes - what is the best way of doing it?
Thank you in advance,
Alex
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm creating a REST service, which works as a proxy, but exposes own model.
So, I'm using dozer to map my object model to remote service object model.
To make my service returning only requested information I added additional "fields" param,
which specifies what properties are requested.
For example, if REST service returns you an Object with 2 fields:
Person {
firstName,
lastName,
}
it should be possible to request Person object with just firstName property like:
GET Person, fields = Person.firstName.
So, here the question - it is clear how to get object from remote service, transform it to my model and return back. But it is totally unclear for me how to transform my Fields (based on my object graph) to a remote fields list. Is it possible to use dozer to solve this problem? It already contains all mappings internally, so theoretically it should be possible.
Example:
Suppose i have my object :
Person {firstName, lastName}
and remote model has:
Human{name, surname}
Requested fields could be: "Person.lastName, Person.firstName"
And the question is - is it possible to use dozer to transform this String into:
"Human.name, Human.surname"
And if yes - what is the best way of doing it?
Thank you in advance,
Alex