Class AggregateJsonWriter
- java.lang.Object
-
- org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter<EntityType>
-
- org.nuxeo.ecm.core.io.marshallers.json.ExtensibleEntityJsonWriter<Aggregate>
-
- org.nuxeo.elasticsearch.io.marshallers.json.AggregateJsonWriter
-
- All Implemented Interfaces:
Marshaller<Aggregate>
,Writer<Aggregate>
@Setup(mode=SINGLETON, priority=2000) public class AggregateJsonWriter extends ExtensibleEntityJsonWriter<Aggregate>
- Since:
- 8.4
-
-
Field Summary
Fields Modifier and Type Field 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-
Fields inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
ctx, registry
-
-
Constructor Summary
Constructors Constructor Description AggregateJsonWriter()
AggregateJsonWriter(String entityType, Class<Aggregate> entityClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.ExtensibleEntityJsonWriter
extend, write
-
Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
getGenerator, write, writeEntity, writeEntity, writeEntityField, writeSerializable, writeSerializableField, writeSerializableListField, writeSerializableMapField
-
-
-
-
Field Detail
-
ENTITY_TYPE
public static final String ENTITY_TYPE
- See Also:
- Constant Field Values
-
FETCH_KEY
public static final String FETCH_KEY
- See Also:
- Constant Field Values
-
SYSTEM_SCHEMA
protected static final Schema SYSTEM_SCHEMA
Fake schema for system properties usable as a page provider aggregate
-
-
Method Detail
-
accept
public boolean accept(Class<?> clazz, Type genericType, javax.ws.rs.core.MediaType mediatype)
Description copied from interface:Marshaller
Checks if this marshaller can handle the marshalling request.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 theMarshallerRegistry
This method implementation can use injected properties. So you can check the current
RenderingContext
to accept or reject a marshalling request.- Specified by:
accept
in interfaceMarshaller<Aggregate>
- Overrides:
accept
in classAbstractJsonWriter<Aggregate>
- Parameters:
clazz
- The type to marshall.genericType
- The generic type to marshall.mediatype
- The managed mimetype.- Returns:
- true if this converter handle the request, false otherwise.
-
writeEntityBody
protected void writeEntityBody(Aggregate agg, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException
Description copied from class:ExtensibleEntityJsonWriter
Implement this method to write the entity body.- Specified by:
writeEntityBody
in classExtensibleEntityJsonWriter<Aggregate>
- Parameters:
agg
- The Java entity.jg
- AJsonGenerator
ready to write your entity as Json.- Throws:
IOException
-
writeBuckets
protected void writeBuckets(String fieldName, List<Bucket> buckets, Field field, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException
- Throws:
IOException
-
-