translate<T extends GeneratedMessage> method

T translate<T extends GeneratedMessage>(
  1. Uri uri,
  2. String responseBody,
  3. T destination
)

Translates the HTTP response body into an object of type T.

By default, parses the response body as JSON.

Parameters:

  • uri URI of the web resource to which the original HTTP request was sent;
  • responseBody body of a successful HTTP response;
  • destination an instance of Proto message into which the translated data is to be merged.

Implementation

T translate<T extends GeneratedMessage>(Uri uri, String responseBody, T destination) {
    parseInto(destination, responseBody);
    return destination;
}