Class AbstractWriter<E>

  • Type Parameters:
    E - the real object class
    All Implemented Interfaces:
    javax.ws.rs.ext.MessageBodyWriter<List<E>>

    public abstract class AbstractWriter<E>
    extends Object
    implements javax.ws.rs.ext.MessageBodyWriter<List<E>>
    This class handle the action of formatting an object E to String with the appropriate MediaType.
    • Constructor Detail

      • AbstractWriter

        public AbstractWriter()
    • Method Detail

      • setFormatters

        public void setFormatters​(Map<String,​IFormatter<E>> mapFormatters)
        Set the formatters
        Parameters:
        mapFormatters - the formatters
      • getSize

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

        public void writeTo​(List<E> listResources,
                            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<E>
        Throws:
        IOException
        javax.ws.rs.WebApplicationException