What is the best way to cast my response from the server ?
- By directly assigning the response to the entity
Ex: authorityStatusWithWorkFlowEntity = response.body();
OR
- First Catching it as
JsonElement
ORJsonArray
ORJsonObject
and then converting it to specifiedentity
?
Ex: lineEstimationEntity = new Gson().fromJson(response.body().getAsJsonObject(), new TypeToken<LineEstimationEntity>() {
}.getType());
In performance wise which is the best practice?