Class AbstractWriter<E>

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

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

      Constructors 
      Constructor Description
      AbstractWriter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getSize​(java.util.List<E> resource, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
      void setFormatters​(java.util.Map<java.lang.String,​IFormatter<E>> mapFormatters)
      Set the formatters
      void writeTo​(java.util.List<E> listResources, java.lang.Class<?> 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.Object> httpHeaders, java.io.OutputStream entityStream)
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.ws.rs.ext.MessageBodyWriter

        isWriteable
    • Constructor Detail

      • AbstractWriter

        public AbstractWriter()
    • Method Detail

      • setFormatters

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

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

        public void writeTo​(java.util.List<E> listResources,
                            java.lang.Class<?> 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.Object> httpHeaders,
                            java.io.OutputStream entityStream)
                     throws java.io.IOException,
                            javax.ws.rs.WebApplicationException
        Specified by:
        writeTo in interface javax.ws.rs.ext.MessageBodyWriter<E>
        Throws:
        java.io.IOException
        javax.ws.rs.WebApplicationException