use of rxreddit.model.UserReport in project RxReddit by damien5314.
the class UserReportDeserializer method deserialize.
@Override
public UserReport deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
JsonArray array = json.getAsJsonArray();
// Extract text element
JsonElement textElement = array.get(0);
String text = textElement instanceof JsonNull ? null : textElement.getAsString();
// Extract quantity element
int quantity = array.get(1).getAsInt();
return new UserReport(text, quantity);
}
Aggregations