fr.paris.lutece.plugins.rest.service.writers
Class AbstractWriter<E>

java.lang.Object
  extended by fr.paris.lutece.plugins.rest.service.writers.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 Summary
AbstractWriter()
           
 
Method Summary
 long getSize(List<E> resource, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
          
 void setFormatters(Map<String,IFormatter<E>> mapFormatters)
          Set the formatters
 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)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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(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<List<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<List<E>>
Throws:
IOException
javax.ws.rs.WebApplicationException


Copyright © 2013 Mairie de Paris. All Rights Reserved.