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.JsonFactory
factory
-
Constructor Summary
Constructors Constructor Description EntityWriter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract String
getEntityType()
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)
-
-
-
Method Detail
-
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
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 IOException
Write 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.
-
-