Class ExtensibleEntityJsonWriter<EntityType>

java.lang.Object
org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter<EntityType>
org.nuxeo.ecm.core.io.marshallers.json.ExtensibleEntityJsonWriter<EntityType>
Type Parameters:
EntityType - The managed Java type.
All Implemented Interfaces:
Marshaller<EntityType>, Writer<EntityType>
Direct Known Subclasses:
ACPJsonWriter, AggregateJsonWriter, AnnotationJsonWriter, BinaryManagerStatusJsonWriter, BulkCommandJsonWriter, BulkStatusJsonWriter, CapabilitiesJsonWriter, CommentJsonWriter, ConfigurationPropertiesJsonWriter, ConstraintJsonWriter, DirectoryEntryJsonWriter, DirectoryJsonWriter, DocumentModelJsonWriter, DocumentRouteWriter, DocumentTypeJsonWriter, DocumentValidationReportJsonWriter, FacetJsonWriter, GraphRouteWriter, LogEntryJsonWriter, MigrationJsonWriter, NuxeoGroupJsonWriter, NuxeoOAuth2ServiceProviderWriter, NuxeoOAuth2TokenWriter, NuxeoPrincipalJsonWriter, OAuth2ClientWriter, ProbeInfoJsonWriter, ProbeStatusJsonWriter, SavedSearchWriter, ScheduleJsonWriter, SchemaJsonWriter, SimplifiedServerInfoJsonWriter, TaskWriter

public abstract class ExtensibleEntityJsonWriter<EntityType> extends AbstractJsonWriter<EntityType>
Base class to write Nuxeo Json entity. This class write the json object, the json "entity-type" property and enable all activated enrichers registered in the MarshallerRegistry and compatible with the marshalled Java type.
Since:
7.2
  • Constructor Details

    • ExtensibleEntityJsonWriter

      public ExtensibleEntityJsonWriter(String entityType, Class<EntityType> entityClass)
      Parameters:
      entityType - The "entity-type" Json property value.
      entityClass - The entity type.
  • Method Details

    • write

      public void write(EntityType entity, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException
      Description copied from class: AbstractJsonWriter
      Implement this method to writes the entity in the provided JsonGenerator.

      This method implementation can use injected properties.

      The JsonGenerator's flushing is done by this abstract class, it's also not not necessary to flush it. Do not close the provided JsonGenerator. It may be used is another marshaller calling this one.

      Specified by:
      write in class AbstractJsonWriter<EntityType>
      Parameters:
      entity - The entity to marshall as Json.
      jg - The JsonGenerator used to produce Json output.
      Throws:
      IOException
    • writeEntityBody

      protected abstract void writeEntityBody(EntityType entity, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException
      Implement this method to write the entity body.
      Parameters:
      entity - The Java entity.
      jg - A JsonGenerator ready to write your entity as Json.
      Throws:
      IOException
      Since:
      7.2
    • extend

      protected void extend(EntityType entity, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException
      Override this method to add additional property in the entity. This method is useful to override a marshaller implementing this class.
      Parameters:
      entity - The Java entity.
      jg - A JsonGenerator ready to write your entity as Json.
      Throws:
      IOException
      Since:
      7.2