retrofit.converter
Interface Converter

All Known Implementing Classes:
GsonConverter

public interface Converter

Arbiter for converting objects to and from their representation in HTTP.

Author:
Jake Wharton ([email protected])

Method Summary
 Object fromBody(TypedInput body, Type type)
          Convert an HTTP response body to a concrete object of the specified type.
 TypedOutput toBody(Object object)
          Convert and object to an appropriate representation for HTTP transport.
 

Method Detail

fromBody

Object fromBody(TypedInput body,
                Type type)
                throws ConversionException
Convert an HTTP response body to a concrete object of the specified type.

Parameters:
body - HTTP response body.
type - Target object type.
Returns:
Instance of type which will be cast by the caller.
Throws:
ConversionException - if conversion was unable to complete. This will trigger a call to Callback.failure(retrofit.RetrofitError) or throw a RetrofitError. The exception message should report all necessary information about its cause as the response body will be set to null.

toBody

TypedOutput toBody(Object object)
Convert and object to an appropriate representation for HTTP transport.

Parameters:
object - Object instance to convert.
Returns:
Representation of the specified object as bytes.


Copyright © 2013 Square, Inc.. All Rights Reserved.