Package org.nuxeo.ecm.automation.io.rest
Class EntityListWriter<T>
java.lang.Object
org.nuxeo.ecm.automation.io.rest.EntityWriter<List<T>>
org.nuxeo.ecm.automation.io.rest.EntityListWriter<T>
- All Implemented Interfaces:
jakarta.ws.rs.ext.MessageBodyWriter<List<T>>
- Direct Known Subclasses:
BusinessAdapterListWriter
Abstract class that knows how to serialize List of nuxeo entities. The implementing classes should only implement
getEntityType() and writeItem(JsonGenerator, Object)- Since:
- 5.7.3
-
Field Summary
Fields inherited from class org.nuxeo.ecm.automation.io.rest.EntityWriter
factory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract StringReturns the entity-type value of the list (ie: users, groups....)booleanisWriteable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) protected voidwriteEntityBody(com.fasterxml.jackson.core.JsonGenerator jg, List<T> list) Write the body of the entity.protected voidwriteHeader(com.fasterxml.jackson.core.JsonGenerator jg, List<T> list) Override this method to write into list headerprotected abstract voidWrites the item in a JsonGenerator.protected voidwritePaginableHeader(com.fasterxml.jackson.core.JsonGenerator jg, List<T> list) Methods inherited from class org.nuxeo.ecm.automation.io.rest.EntityWriter
getSize, writeEntity, writeTo
-
Constructor Details
-
EntityListWriter
public EntityListWriter()
-
-
Method Details
-
getEntityType
Returns the entity-type value of the list (ie: users, groups....)- Specified by:
getEntityTypein classEntityWriter<List<T>>- Returns:
- the string representing the entity-type.
-
writeItem
protected abstract void writeItem(com.fasterxml.jackson.core.JsonGenerator jg, T item) throws IOException Writes the item in a JsonGenerator.- Throws:
IOException
-
isWriteable
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) - Specified by:
isWriteablein interfacejakarta.ws.rs.ext.MessageBodyWriter<T>- Overrides:
isWriteablein classEntityWriter<List<T>>
-
writeEntityBody
protected void writeEntityBody(com.fasterxml.jackson.core.JsonGenerator jg, List<T> list) throws IOException Description copied from class:EntityWriterWrite the body of the entity. The object has already been opened and it entity-type rendered.- Specified by:
writeEntityBodyin classEntityWriter<List<T>>- Throws:
IOException
-
writePaginableHeader
protected void writePaginableHeader(com.fasterxml.jackson.core.JsonGenerator jg, List<T> list) throws IOException - Throws:
IOException
-
writeHeader
protected void writeHeader(com.fasterxml.jackson.core.JsonGenerator jg, List<T> list) throws IOException Override this method to write into list header- Throws:
IOException
-