Class AggregateJsonWriter

All Implemented Interfaces:
Marshaller<Aggregate>, Writer<Aggregate>

@Setup(mode=SINGLETON, priority=2000) public class AggregateJsonWriter extends ExtensibleEntityJsonWriter<Aggregate>
Since:
8.4
  • Field Details

  • Constructor Details

    • AggregateJsonWriter

      public AggregateJsonWriter()
    • AggregateJsonWriter

      public AggregateJsonWriter(String entityType, Class<Aggregate> entityClass)
  • Method Details

    • getSystemField

      protected Field getSystemField(String name)
      Since:
      10.3
    • 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 the MarshallerRegistry

      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 interface Marshaller<Aggregate>
      Overrides:
      accept in class AbstractJsonWriter<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 class ExtensibleEntityJsonWriter<Aggregate>
      Parameters:
      agg - The Java entity.
      jg - A JsonGenerator 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