@Setup(mode=SINGLETON, priority=2000) public class AggregateJsonWriter extends ExtensibleEntityJsonWriter<Aggregate>
Modifier and Type | Field and Description |
---|---|
static String |
ENTITY_TYPE |
static String |
FETCH_KEY |
ctx, registry
Constructor and Description |
---|
AggregateJsonWriter() |
AggregateJsonWriter(String entityType,
Class<Aggregate> entityClass) |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Class<?> clazz,
Type genericType,
javax.ws.rs.core.MediaType mediatype)
Checks if this marshaller can handle the marshalling request.
|
protected void |
writeBuckets(String fieldName,
List<Bucket> buckets,
Field field,
org.codehaus.jackson.JsonGenerator jg) |
protected void |
writeEntityBody(Aggregate agg,
org.codehaus.jackson.JsonGenerator jg)
Implement this method to write the entity body.
|
extend, write
getGenerator, write, writeEntity, writeEntity, writeEntityField
public static final String ENTITY_TYPE
public static final String FETCH_KEY
public AggregateJsonWriter()
public AggregateJsonWriter(String entityType, Class<Aggregate> entityClass)
public boolean accept(Class<?> clazz, Type genericType, javax.ws.rs.core.MediaType mediatype)
Marshaller
Please note it's useless to check that clazz is an instance of EntityType or if generic type and entity type are
compatible (unlike JAX-RS which just checks the clazz, not the generic type). It's also useless to check
Supports
is compatible with mediatype. This is already done by the MarshallerRegistry
This method implementation can use injected properties. So you can check the current RenderingContext
to
accept or reject a marshalling request.
accept
in interface Marshaller<Aggregate>
accept
in class AbstractJsonWriter<Aggregate>
clazz
- The type to marshall.genericType
- The generic type to marshall.mediatype
- The managed mimetype.protected void writeEntityBody(Aggregate agg, org.codehaus.jackson.JsonGenerator jg) throws IOException
ExtensibleEntityJsonWriter
writeEntityBody
in class ExtensibleEntityJsonWriter<Aggregate>
agg
- The Java entity.jg
- A JsonGenerator
ready to write your entity as Json.IOException
protected void writeBuckets(String fieldName, List<Bucket> buckets, Field field, org.codehaus.jackson.JsonGenerator jg) throws IOException, org.codehaus.jackson.JsonGenerationException
IOException
org.codehaus.jackson.JsonGenerationException
Copyright © 2017 Nuxeo. All rights reserved.