Class EntityWriter<T>
java.lang.Object
org.nuxeo.ecm.automation.jaxrs.io.EntityWriter<T>
- All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyWriter<T>
- Direct Known Subclasses:
ConversionScheduledWriter
,ConversionStatusWithResultWriter
,EntityListWriter
public abstract class EntityWriter<T>
extends Object
implements javax.ws.rs.ext.MessageBodyWriter<T>
Base class to write json entities
- Since:
- 5.7.3
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract String
get the Entity type of the current entity type.long
getSize
(T t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) boolean
isWriteable
(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) void
writeEntity
(com.fasterxml.jackson.core.JsonGenerator jg, T item) protected abstract void
writeEntityBody
(com.fasterxml.jackson.core.JsonGenerator jg, T item) Write the body of the entity.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)
-
Field Details
-
factory
@Context protected com.fasterxml.jackson.core.JsonFactory factory
-
-
Constructor Details
-
EntityWriter
public EntityWriter()
-
-
Method Details
-
isWriteable
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) - Specified by:
isWriteable
in interfacejavax.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 interfacejavax.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 interfacejavax.ws.rs.ext.MessageBodyWriter<T>
- Throws:
IOException
javax.ws.rs.WebApplicationException
-
writeEntity
- 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
get the Entity type of the current entity type. It MUST follow camelCase notation- Returns:
- the string representing the entity-type.
-