public final class JacksonIteratorDecoder extends Object implements Decoder
Response when it reached json array end or failed to parse stream.
If this iterator is not fetched till the end, it has to be casted to Closeable and explicity Closeable#close by the consumer.
Example:
Feign.builder()
.decoder(JacksonIteratorDecoder.create())
.doNotCloseAfterDecode() // Required to fetch the iterator after the response is processed, need to be close
.target(GitHub.class, "https://api.github.com");
interface GitHub {
@RequestLine("GET /repos/{owner}/{repo}/contributors")
Iterator contributors(@Param("owner") String owner, @Param("repo") String repo);
} Decoder.Default| Modifier and Type | Method and Description |
|---|---|
static JacksonIteratorDecoder |
create() |
static JacksonIteratorDecoder |
create(Iterable<com.fasterxml.jackson.databind.Module> modules) |
static JacksonIteratorDecoder |
create(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
Object |
decode(Response response,
Type type) |
public Object decode(Response response, Type type) throws IOException
decode in interface DecoderIOExceptionpublic static JacksonIteratorDecoder create()
public static JacksonIteratorDecoder create(Iterable<com.fasterxml.jackson.databind.Module> modules)
public static JacksonIteratorDecoder create(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Copyright © 2012–2018 OpenFeign. All rights reserved.