Package io.avaje.http.client
Class JacksonBodyAdapter
- java.lang.Object
-
- io.avaje.http.client.JacksonBodyAdapter
-
- All Implemented Interfaces:
BodyAdapter
public class JacksonBodyAdapter extends Object implements BodyAdapter
Jackson BodyAdapter to read and write beans as JSON.HttpClientContext.newBuilder() .withBaseUrl(baseUrl) .withRequestListener(new RequestLogger()) .withBodyAdapter(new JacksonBodyAdapter(new ObjectMapper())) //.withBodyAdapter(new GsonBodyAdapter(new Gson())) .build();
-
-
Constructor Summary
Constructors Constructor Description JacksonBodyAdapter(com.fasterxml.jackson.databind.ObjectMapper mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> BodyReader<T>
beanReader(Class<T> cls)
BodyWriter
beanWriter(Class<?> cls)
<T> BodyReader<List<T>>
listReader(Class<T> cls)
-
-
-
Method Detail
-
beanWriter
public BodyWriter beanWriter(Class<?> cls)
- Specified by:
beanWriter
in interfaceBodyAdapter
-
beanReader
public <T> BodyReader<T> beanReader(Class<T> cls)
- Specified by:
beanReader
in interfaceBodyAdapter
-
listReader
public <T> BodyReader<List<T>> listReader(Class<T> cls)
- Specified by:
listReader
in interfaceBodyAdapter
-
-