Class JsonIdAdderBodyReader

  • All Implemented Interfaces:
    javax.ws.rs.ext.MessageBodyReader<java.lang.Object>

    @Provider
    @Consumes("application/json")
    public class JsonIdAdderBodyReader
    extends java.lang.Object
    implements javax.ws.rs.ext.MessageBodyReader<java.lang.Object>
    Sometimes resteasy will not unmarshal an json because there is no type information, but the prototype actually specifies it fully. The message body reader will deal with that, by adding the id implicetely (if it is missing) before the actual unmarshal.
    Since:
    2.7
    Author:
    Michiel Meeuwissen
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isReadable​(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)  
      java.lang.Object readFrom​(java.lang.Class<java.lang.Object> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> httpHeaders, java.io.InputStream entityStream)  
      • Methods inherited from class java.lang.Object

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

      • JsonIdAdderBodyReader

        public JsonIdAdderBodyReader()
    • Method Detail

      • isReadable

        public boolean isReadable​(java.lang.Class<?> type,
                                  java.lang.reflect.Type genericType,
                                  java.lang.annotation.Annotation[] annotations,
                                  javax.ws.rs.core.MediaType mediaType)
        Specified by:
        isReadable in interface javax.ws.rs.ext.MessageBodyReader<java.lang.Object>
      • readFrom

        public java.lang.Object readFrom​(java.lang.Class<java.lang.Object> type,
                                         java.lang.reflect.Type genericType,
                                         java.lang.annotation.Annotation[] annotations,
                                         javax.ws.rs.core.MediaType mediaType,
                                         javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> httpHeaders,
                                         java.io.InputStream entityStream)
                                  throws javax.ws.rs.WebApplicationException,
                                         java.io.IOException
        Specified by:
        readFrom in interface javax.ws.rs.ext.MessageBodyReader<java.lang.Object>
        Throws:
        javax.ws.rs.WebApplicationException
        java.io.IOException