Class AbstractWriter<E>
java.lang.Object
fr.paris.lutece.plugins.rest.service.writers.AbstractWriter<E>
- Type Parameters:
E- the real object class
- All Implemented Interfaces:
jakarta.ws.rs.ext.MessageBodyWriter<List<E>>
public abstract class AbstractWriter<E>
extends Object
implements jakarta.ws.rs.ext.MessageBodyWriter<List<E>>
This class handle the action of formatting an object E to String with the appropriate MediaType.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetSize(List<E> resource, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) voidsetFormatters(Map<String, IFormatter<E>> mapFormatters) Set the formattersvoidwriteTo(List<E> listResources, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.ws.rs.ext.MessageBodyWriter
isWriteable
-
Constructor Details
-
AbstractWriter
public AbstractWriter()
-
-
Method Details
-
setFormatters
Set the formatters- Parameters:
mapFormatters- the formatters
-
getSize
public long getSize(List<E> resource, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) - Specified by:
getSizein interfacejakarta.ws.rs.ext.MessageBodyWriter<E>
-
writeTo
public void writeTo(List<E> listResources, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, jakarta.ws.rs.WebApplicationException- Specified by:
writeToin interfacejakarta.ws.rs.ext.MessageBodyWriter<E>- Throws:
IOExceptionjakarta.ws.rs.WebApplicationException
-