Class 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 is Type.getName() (string, boolean, integer, ...)
         "PRIMITIVE_LIST_LOCAL_NAME": "FIELD_TYPE[]" <- where field type is 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
     }
     
    Since:
    7.2