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 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 interface javax.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 interface javax.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 interface javax.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.