@Setup(mode=SINGLETON, priority=2000) public class ConstraintJsonWriter extends ExtensibleEntityJsonWriter<Constraint>
Constraint
to Json.
This marshaller is enrichable: register class implementing AbstractJsonEnricher
and managing
Constraint
.
This marshaller is also extensible: extend it and simply override
ExtensibleEntityJsonWriter#extend(Constraint, JsonWriter)
.
Format is:
{ "entity-type":"validation_constraint", "name": "CONSTRAINT_NAME", "parameters": { "PARAMETER1_NAME": "PARAMETER1_VALUE", "PARAMETER2_NAME": "PARAMETER2_VALUE", ... } <-- 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 |
---|
ConstraintJsonWriter() |
Modifier and Type | Method and Description |
---|---|
protected void |
writeEntityBody(Constraint constraint,
org.codehaus.jackson.JsonGenerator jg)
Implement this method to write the entity body.
|
extend, write
accept, getGenerator, write, writeEntity, writeEntity, writeEntityField
public static final String ENTITY_TYPE
public ConstraintJsonWriter()
protected void writeEntityBody(Constraint constraint, org.codehaus.jackson.JsonGenerator jg) throws IOException
ExtensibleEntityJsonWriter
writeEntityBody
in class ExtensibleEntityJsonWriter<Constraint>
constraint
- The Java entity.jg
- A JsonGenerator
ready to write your entity as Json.IOException
Copyright © 2016 Nuxeo SA. All rights reserved.