java.lang.Object
io.avaje.http.client.JsonbBodyAdapter
- All Implemented Interfaces:
BodyAdapter
Avaje Jsonb BodyAdapter to read and write beans as JSON.
HttpClient.builder()
.baseUrl(baseUrl)
.bodyAdapter(new JsonbBodyAdapter())
.build();
-
Constructor Summary
ConstructorsConstructorDescriptionCreate with a default Jsonb that allows unknown properties.JsonbBodyAdapter(io.avaje.jsonb.Jsonb jsonb) Create passing the Jsonb to use. -
Method Summary
Modifier and TypeMethodDescription<T> BodyReader<T> beanReader(Class<T> cls) Return a BodyReader to read response content and convert to a bean.<T> BodyReader<T> beanReader(Type type) Return a BodyReader to read response content and convert to a bean.<T> BodyWriter<T> beanWriter(Class<?> cls) Return a BodyWriter to write beans of this type as request content.<T> BodyWriter<T> beanWriter(Type type) Return a BodyWriter to write beans of this type as request content.<T> BodyReader<List<T>> listReader(Class<T> cls) Return a BodyReader to read response content and convert to a list of beans.<T> BodyReader<List<T>> listReader(Type type) Return a BodyReader to read response content and convert to a list of beans.
-
Constructor Details
-
JsonbBodyAdapter
public JsonbBodyAdapter(io.avaje.jsonb.Jsonb jsonb) Create passing the Jsonb to use. -
JsonbBodyAdapter
public JsonbBodyAdapter()Create with a default Jsonb that allows unknown properties.
-
-
Method Details
-
beanWriter
Description copied from interface:BodyAdapterReturn a BodyWriter to write beans of this type as request content.- Specified by:
beanWriterin interfaceBodyAdapter- Parameters:
cls- The type of the bean this writer is for
-
beanWriter
Description copied from interface:BodyAdapterReturn a BodyWriter to write beans of this type as request content.- Specified by:
beanWriterin interfaceBodyAdapter- Parameters:
type- The type of the bean this writer is for
-
beanReader
Description copied from interface:BodyAdapterReturn a BodyReader to read response content and convert to a bean.- Specified by:
beanReaderin interfaceBodyAdapter- Parameters:
cls- The bean type to convert the content to.
-
beanReader
Description copied from interface:BodyAdapterReturn a BodyReader to read response content and convert to a bean.- Specified by:
beanReaderin interfaceBodyAdapter- Parameters:
type- The bean type to convert the content to.
-
listReader
Description copied from interface:BodyAdapterReturn a BodyReader to read response content and convert to a list of beans.- Specified by:
listReaderin interfaceBodyAdapter- Parameters:
type- The bean type to convert the content to.
-
listReader
Description copied from interface:BodyAdapterReturn a BodyReader to read response content and convert to a list of beans.- Specified by:
listReaderin interfaceBodyAdapter- Parameters:
cls- The bean type to convert the content to.
-