Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. public class LoginContextUnwrappingConverter extends Converter.Factory {
  2. @Override
  3. public Converter<ResponseBody, LoginContext>
  4. responseBodyConverter(Type type,
  5. Annotation[] annotations,
  6. Retrofit retrofit) {
  7. if (type != LoginContext.class) {
  8. return null;
  9. }
  10.  
  11. final Converter<ResponseBody, LoginResponse> delegate =
  12. retrofit.nextResponseBodyConverter(this,
  13. LoginResponse.class,
  14. annotations);
  15.  
  16. return body -> {
  17. LoginResponse wrapper = delegate.convert(body);
  18. return wrapper.context();
  19. };
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement