0
We have an Endpoint in Rest for access to a partner’s data, also in Rest. (We use Springboot)
Their answer is in Portuguese. According to our client’s policy, all 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 above example the controller returns the Dermatologist class, but I need the return to be in English. With the variable names. But 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, is there a way I can copy the two objects using Reflection or something like that? Remember that there is only one example. The return objects would be identical, but have lists and other internal objects.
Grateful.
Fantastic. Thank you Felipão =]
– Felipe Cafaro