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 theMarshallerRegistry
and compatible with the marshalled Java type.- Since:
- 7.2
-
-
Field Summary
-
Fields inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
ctx, registry
-
-
Constructor Summary
Constructors Constructor Description ExtensibleEntityJsonWriter(String entityType, Class<EntityType> entityClass)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
extend(EntityType entity, com.fasterxml.jackson.core.JsonGenerator jg)
Override this method to add additional property in the entity.void
write(EntityType entity, com.fasterxml.jackson.core.JsonGenerator jg)
Implement this method to writes the entity in the providedJsonGenerator
.protected abstract void
writeEntityBody(EntityType entity, com.fasterxml.jackson.core.JsonGenerator jg)
Implement this method to write the entity body.-
Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
accept, getGenerator, write, writeEntity, writeEntity, writeEntityField, writeSerializable, writeSerializableField, writeSerializableListField, writeSerializableMapField
-
-
-
-
Constructor Detail
-
ExtensibleEntityJsonWriter
public ExtensibleEntityJsonWriter(String entityType, Class<EntityType> entityClass)
- Parameters:
entityType
- The "entity-type" Json property value.entityClass
- The entity type.
-
-
Method Detail
-
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 providedJsonGenerator
.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 providedJsonGenerator
. It may be used is another marshaller calling this one.- Specified by:
write
in classAbstractJsonWriter<EntityType>
- Parameters:
entity
- The entity to marshall as Json.jg
- TheJsonGenerator
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
- AJsonGenerator
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
- AJsonGenerator
ready to write your entity as Json.- Throws:
IOException
- Since:
- 7.2
-
-