@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 |
protected static Schema |
SYSTEM_SCHEMA
Fake schema for system properties usable as a page provider aggregate
|
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 Field |
getSystemField(String name) |
protected void |
writeBuckets(String fieldName,
List<Bucket> buckets,
Field field,
com.fasterxml.jackson.core.JsonGenerator jg) |
protected void |
writeEntityBody(Aggregate agg,
com.fasterxml.jackson.core.JsonGenerator jg)
Implement this method to write the entity body.
|
extend, write
getGenerator, write, writeEntity, writeEntity, writeEntityField, writeSerializable, writeSerializableField, writeSerializableListField, writeSerializableMapField
public static final String ENTITY_TYPE
public static final String FETCH_KEY
protected static final Schema SYSTEM_SCHEMA
public AggregateJsonWriter()
public AggregateJsonWriter(String entityType, Class<Aggregate> entityClass)
protected Field getSystemField(String name)
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, com.fasterxml.jackson.core.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, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
IOException
com.fasterxml.jackson.core.JsonGenerationException
Copyright © 2019 Nuxeo. All rights reserved.