Package feign.jaxb

Class JAXBDecoder

  • All Implemented Interfaces:
    feign.codec.Decoder

    public class JAXBDecoder
    extends java.lang.Object
    implements feign.codec.Decoder
    Decodes responses using JAXB.

    Basic example with with Feign.Builder:

     JAXBContextFactory jaxbFactory = new JAXBContextFactory.Builder()
         .withMarshallerJAXBEncoding("UTF-8")
         .withMarshallerSchemaLocation("http://apihost http://apihost/schema.xsd")
         .build();
     
     api = Feign.builder()
         .decoder(new JAXBDecoder(jaxbFactory))
         .target(MyApi.class, "http://api");
     

    The JAXBContextFactory should be reused across requests as it caches the created JAXB contexts.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  JAXBDecoder.Builder  
      • Nested classes/interfaces inherited from interface feign.codec.Decoder

        feign.codec.Decoder.Default
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object decode​(feign.Response response, java.lang.reflect.Type type)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • decode

        public java.lang.Object decode​(feign.Response response,
                                       java.lang.reflect.Type type)
                                throws java.io.IOException
        Specified by:
        decode in interface feign.codec.Decoder
        Throws:
        java.io.IOException