@Setup(mode=SINGLETON, priority=2000) public class SchemaJsonWriter extends ExtensibleEntityJsonWriter<Schema>
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(Schema, JsonWriter)
.
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 {@link Type#getName()} (string, boolean, integer, ...) "PRIMITIVE_LIST_LOCAL_NAME": "FIELD_TYPE[]" <- where field type is {@link Type#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 }
Modifier and Type | Field and Description |
---|---|
static String |
ENTITY_TYPE |
ctx, registry
Constructor and Description |
---|
SchemaJsonWriter() |
Modifier and Type | Method and Description |
---|---|
protected void |
writeEntityBody(Schema schema,
org.codehaus.jackson.JsonGenerator jg)
Implement this method to write the entity body.
|
protected void |
writeField(org.codehaus.jackson.JsonGenerator jg,
Field field) |
extend, write
accept, getGenerator, write, writeEntity, writeEntity, writeEntityField
public static final String ENTITY_TYPE
public SchemaJsonWriter()
protected void writeEntityBody(Schema schema, org.codehaus.jackson.JsonGenerator jg) throws IOException
ExtensibleEntityJsonWriter
writeEntityBody
in class ExtensibleEntityJsonWriter<Schema>
schema
- The Java entity.jg
- A JsonGenerator
ready to write your entity as Json.IOException
protected void writeField(org.codehaus.jackson.JsonGenerator jg, Field field) throws IOException
IOException
Copyright © 2015 Nuxeo SA. All rights reserved.