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,LogEntryWriter
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
Fields Modifier and Type Field Description protected com.fasterxml.jackson.core.JsonFactoryfactory
-
Constructor Summary
Constructors Constructor Description EntityWriter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract StringgetEntityType()get the Entity type of the current entity type.longgetSize(T t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)booleanisWriteable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)voidwriteEntity(com.fasterxml.jackson.core.JsonGenerator jg, T item)protected abstract voidwriteEntityBody(com.fasterxml.jackson.core.JsonGenerator jg, T item)Write the body of the entity.voidwriteTo(T entity, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream)
-
-
-
Method Detail
-
isWriteable
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
- Specified by:
isWriteablein 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:
getSizein 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:
writeToin interfacejavax.ws.rs.ext.MessageBodyWriter<T>- Throws:
IOExceptionjavax.ws.rs.WebApplicationException
-
writeEntity
public void writeEntity(com.fasterxml.jackson.core.JsonGenerator jg, T item) throws IOException- Throws:
IOException
-
writeEntityBody
protected abstract void writeEntityBody(com.fasterxml.jackson.core.JsonGenerator jg, T item) throws IOExceptionWrite the body of the entity. The object has already been opened and it entity-type rendered.- Throws:
IOException
-
getEntityType
protected abstract String getEntityType()
get the Entity type of the current entity type. It MUST follow camelCase notation- Returns:
- the string representing the entity-type.
-
-