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>
ConvertSchema
to Json.This marshaller is enrichable: register class implementing
AbstractJsonEnricher
and managingSchema
.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 is
Type.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 Modifier and Type Field Description static String
ENTITY_TYPE
static String
FETCH_FIELDS
-
Fields inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
ctx, registry
-
-
Constructor Summary
Constructors Constructor Description SchemaJsonWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 Detail
-
ENTITY_TYPE
public static final String ENTITY_TYPE
- See Also:
- Constant Field Values
-
FETCH_FIELDS
public static final String FETCH_FIELDS
- Since:
- 8.10
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SchemaJsonWriter
public SchemaJsonWriter()
-
-
Method Detail
-
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
-
-