Class JsonbBodyAdapter

  • All Implemented Interfaces:
    BodyAdapter

    public class JsonbBodyAdapter
    extends Object
    implements BodyAdapter
    avaje jsonb BodyAdapter to read and write beans as JSON.
    
    
       HttpClientContext.newBuilder()
           .baseUrl(baseUrl)
           .bodyAdapter(new JsonbBodyAdapter())
           .build();
    
     
    • Constructor Detail

      • 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 Detail

      • beanWriter

        public <T> BodyWriter<T> beanWriter​(Class<?> cls)
        Description copied from interface: BodyAdapter
        Return a BodyWriter to write beans of this type as request content.
        Specified by:
        beanWriter in interface BodyAdapter
        Parameters:
        cls - The type of the bean this writer is for
      • beanReader

        public <T> BodyReader<T> beanReader​(Class<T> cls)
        Description copied from interface: BodyAdapter
        Return a BodyReader to read response content and convert to a bean.
        Specified by:
        beanReader in interface BodyAdapter
        Parameters:
        cls - The bean type to convert the content to.
      • listReader

        public <T> BodyReader<List<T>> listReader​(Class<T> cls)
        Description copied from interface: BodyAdapter
        Return a BodyReader to read response content and convert to a list of beans.
        Specified by:
        listReader in interface BodyAdapter
        Parameters:
        cls - The bean type to convert the content to.