EntityType
- The managed Java type.public abstract class ExtensibleEntityJsonWriter<EntityType> extends AbstractJsonWriter<EntityType>
MarshallerRegistry
and compatible with the marshalled Java type.ctx, registry
Constructor and Description |
---|
ExtensibleEntityJsonWriter(String entityType,
Class<EntityType> entityClass) |
Modifier and Type | Method and Description |
---|---|
protected void |
extend(EntityType entity,
org.codehaus.jackson.JsonGenerator jg)
Override this method to add additional property in the entity.
|
void |
write(EntityType entity,
org.codehaus.jackson.JsonGenerator jg)
Implement this method to writes the entity in the provided
JsonGenerator . |
protected abstract void |
writeEntityBody(EntityType entity,
org.codehaus.jackson.JsonGenerator jg)
Implement this method to write the entity body.
|
accept, getGenerator, write, writeEntity, writeEntity, writeEntityField
public ExtensibleEntityJsonWriter(String entityType, Class<EntityType> entityClass)
entityType
- The "entity-type" Json property value.entityClass
- The entity type.public void write(EntityType entity, org.codehaus.jackson.JsonGenerator jg) throws IOException
AbstractJsonWriter
JsonGenerator
.
This method implementation can use injected properties.
The JsonGenerator
's flushing is done by this abstract class, it's also not not necessary to flush it. Do
not close the provided JsonGenerator
. It may be used is another marshaller calling this one.
write
in class AbstractJsonWriter<EntityType>
entity
- The entity to marshall as Json.jg
- The JsonGenerator
used to produce Json output.IOException
protected abstract void writeEntityBody(EntityType entity, org.codehaus.jackson.JsonGenerator jg) throws IOException
entity
- The Java entity.jg
- A JsonGenerator
ready to write your entity as Json.IOException
protected void extend(EntityType entity, org.codehaus.jackson.JsonGenerator jg) throws IOException
entity
- The Java entity.jg
- A JsonGenerator
ready to write your entity as Json.IOException
Copyright © 2016 Nuxeo SA. All rights reserved.