Class EntityWriter<T>

    • Field Detail

      • factory

        @Context
        protected com.fasterxml.jackson.core.JsonFactory factory
    • Constructor Detail

      • EntityWriter

        public EntityWriter()
    • Method Detail

      • isWriteable

        public boolean isWriteable​(Class<?> type,
                                   Type genericType,
                                   Annotation[] annotations,
                                   javax.ws.rs.core.MediaType mediaType)
        Specified by:
        isWriteable in interface javax.ws.rs.ext.MessageBodyWriter<T>
      • getSize

        public long getSize​(T t,
                            Class<?> type,
                            Type genericType,
                            Annotation[] annotations,
                            javax.ws.rs.core.MediaType mediaType)
        Specified by:
        getSize in interface javax.ws.rs.ext.MessageBodyWriter<T>
      • writeTo

        public void writeTo​(T entity,
                            Class<?> type,
                            Type genericType,
                            Annotation[] annotations,
                            javax.ws.rs.core.MediaType mediaType,
                            javax.ws.rs.core.MultivaluedMap<String,​Object> httpHeaders,
                            OutputStream entityStream)
                     throws IOException,
                            javax.ws.rs.WebApplicationException
        Specified by:
        writeTo in interface javax.ws.rs.ext.MessageBodyWriter<T>
        Throws:
        IOException
        javax.ws.rs.WebApplicationException
      • writeEntity

        public void writeEntity​(com.fasterxml.jackson.core.JsonGenerator jg,
                                T item)
                         throws IOException
        Throws:
        IOException
      • writeEntityBody

        protected abstract void writeEntityBody​(com.fasterxml.jackson.core.JsonGenerator jg,
                                                T item)
                                         throws IOException
        Write the body of the entity. The object has already been opened and it entity-type rendered.
        Throws:
        IOException
      • getEntityType

        protected abstract String getEntityType()
        get the Entity type of the current entity type. It MUST follow camelCase notation
        Returns:
        the string representing the entity-type.