| 1 |
package com.fasterxml.jackson.jr.retrofit2; |
| 2 |
|
| 3 |
import java.io.IOException; |
| 4 |
import java.util.List; |
| 5 |
|
| 6 |
import com.fasterxml.jackson.jr.ob.JSON; |
| 7 |
|
| 8 |
import okhttp3.ResponseBody; |
| 9 |
|
| 10 |
import retrofit2.Converter; |
| 11 |
|
| 12 |
public class JacksonJrResponseArrayConverter<T> implements Converter<ResponseBody, List<T>> |
| 13 |
{ |
| 14 |
protected final JSON _jr; |
| 15 |
protected final Class<T> _type; |
| 16 |
|
| 17 |
public JacksonJrResponseArrayConverter(JSON jr, Class<T> type) { |
| 18 |
_jr = jr; |
| 19 |
_type = type; |
| 20 |
} |
| 21 |
|
| 22 |
@Override |
| 23 |
public List<T> convert(ResponseBody value) throws IOException { |
| 24 |
return _jr.listOfFrom(_type, value.bytes()); |
| 25 |
} |
| 26 |
} |