In my Spring RESTful Service I have Domain Object Car
, all service business logic uses it. These objects are obtained from CarDTO
objects which in turn are obtained from several external services using RestTemplate
.
The questions are:
- Is it rational to create separate DTO for each external service if consuming structure is different and map them do domain object by different converters, or it's better to use general DTO and converter?
- If my previous suggestions are wrong - what is the pest practice of consuming domain object from several api with different structure?
Car domain object:
public class Car {
private Company company;
private String model;
private Location location;
private Double fuel;
private Double price;
// getters / setters
}