We have an EndPoint in Rest for accessing data from a partner, also in Rest. (we use SpringBoot)
Their response is all in Portuguese. In accordance with our customer policy, all of our EndPoint code and interface must be in English.
I have the following scenario:
// Controller
@GetMapping("/getClinicalRecord")
public Dermatologist getFichaClinica(@RequestHeader(X_SECURITY_TOKEN) final String token) {
Usuario usuario = getUsuario(token);
final Dermatologist response = getFichaClinicaApiService().getFichaClinica(usuario);
return response;
}
// Response
public class Dermatologist {
@JsonProperty("temCancer")
private Integer hasCancer;
@JsonProperty("cancer")
private String cancer;
@JsonProperty("fezCirurgia")
private Integer didSurgery;
@JsonProperty("temTatuagem")
private Integer hasTatto;
}
In the example above the controller returns the Dermatologist class, however I need the return to be in English. With variable names. However, it is being displayed according to the values reported in JsonProperty.
Is there any annotation that solves this?
I was suggested to create a class to perform the return, and copy the output of our partner in this new object, which would be:
public class Dermatologist {
private Integer hasCancer;
private String cancer;
private Integer didSurgery;
private Integer hasTatto;
}
Considering this approach, can I do the copy of the two objects using Reflection or something like that? Remember that there is only one example. Return objects would be identical, but have lists and other internal objects.
Thank you.