Class SchemaJsonWriter
java.lang.Object
org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter<EntityType>
org.nuxeo.ecm.core.io.marshallers.json.ExtensibleEntityJsonWriter<Schema>
org.nuxeo.ecm.core.io.marshallers.json.types.SchemaJsonWriter
- All Implemented Interfaces:
Marshaller<Schema>
,Writer<Schema>
@Setup(mode=SINGLETON,
priority=2000)
public class SchemaJsonWriter
extends ExtensibleEntityJsonWriter<Schema>
Convert
Schema
to Json.
This marshaller is enrichable: register class implementing AbstractJsonEnricher
and managing Schema
.
This marshaller is also extensible: extend it and simply override
ExtensibleEntityJsonWriter.extend(Object, JsonGenerator)
.
Format is:
{ "entity-type":"schema", "name": "SCHEMA_NAME", "prefix: "SCHEMA_PREFIX", <- only if there's a prefix "fields", { "PRIMITIVE_FIELD_LOCAL_NAME": "FIELD_TYPE", <- where field type isType.getName()
(string, boolean, integer, ...) "PRIMITIVE_LIST_LOCAL_NAME": "FIELD_TYPE[]" <- where field type isType.getName()
(string, boolean, integer, ...) "COMPLEX_FIELD_LOCAL_NAME" : { "type": "complex", "fields": { loop the same format } }, "COMPLEX_LIST_FIELD_LOCAL_NAME" : { "type": "complex[]", "fields": { loop the same format } }, "CONTENT_FIELD": "blob", "CONTENT_LIST_FIELD": "blob[]", ... } <-- contextParameters if there are enrichers activated <-- additional property provided by extend() method }
- Since:
- 7.2
-
Field Summary
Fields inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
ctx, registry
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doWriteField
(com.fasterxml.jackson.core.JsonGenerator jg, Field field) protected void
writeEntityBody
(Schema schema, com.fasterxml.jackson.core.JsonGenerator jg) Implement this method to write the entity body.protected void
writeField
(com.fasterxml.jackson.core.JsonGenerator jg, Field field) Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.ExtensibleEntityJsonWriter
extend, write
Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
accept, getGenerator, write, writeEntity, writeEntity, writeEntityField, writeSerializable, writeSerializableField, writeSerializableListField, writeSerializableMapField
-
Field Details
-
ENTITY_TYPE
- See Also:
-
FETCH_FIELDS
- Since:
- 8.10
- See Also:
-
-
Constructor Details
-
SchemaJsonWriter
public SchemaJsonWriter()
-
-
Method Details
-
writeEntityBody
protected void writeEntityBody(Schema schema, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException Description copied from class:ExtensibleEntityJsonWriter
Implement this method to write the entity body.- Specified by:
writeEntityBody
in classExtensibleEntityJsonWriter<Schema>
- Parameters:
schema
- The Java entity.jg
- AJsonGenerator
ready to write your entity as Json.- Throws:
IOException
-
writeField
protected void writeField(com.fasterxml.jackson.core.JsonGenerator jg, Field field) throws IOException - Throws:
IOException
-
doWriteField
protected void doWriteField(com.fasterxml.jackson.core.JsonGenerator jg, Field field) throws IOException - Throws:
IOException
- Since:
- 8.10
-