Class AbstractJsonEnricher<EntityType>
- java.lang.Object
-
- org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter<Enriched<EntityType>>
-
- org.nuxeo.ecm.core.io.marshallers.json.enrichers.AbstractJsonEnricher<EntityType>
-
- Type Parameters:
EntityType- The Java type whose the generated JSON will be enriched.
- All Implemented Interfaces:
Marshaller<Enriched<EntityType>>,Writer<Enriched<EntityType>>
- Direct Known Subclasses:
ACLJsonEnricher,AuditJsonEnricher,BasePermissionsJsonEnricher,BlobAppLinksJsonEnricher,BlobPreviewJsonEnricher,BreadcrumbJsonEnricher,ChildrenJsonEnricher,CollectionsJsonEnricher,ContextualParametersJsonEnricher,DocumentUrlJsonEnricher,FavoritesJsonEnricher,FirstAccessibleAncestorJsonEnricher,HasContentJsonEnricher,HasFolderishChildJsonEnricher,HighlightJsonEnricher,NotificationsJsonEnricher,PendingTasksJsonEnricher,PreviewJsonEnricher,PublicationJsonEnricher,RenditionJsonEnricher,RunnableWorkflowJsonEnricher,RunningWorkflowJsonEnricher,SubtypesJsonEnricher,SubtypesJsonEnricher,TagsJsonEnricher,ThumbnailJsonEnricher,UserProfileEnricher,UserVisiblePermissionsJsonEnricher,WOPIJsonEnricher
public abstract class AbstractJsonEnricher<EntityType> extends AbstractJsonWriter<Enriched<EntityType>>
Base class to writeExtensibleEntityJsonWriter's enricher.- Since:
- 7.2
-
-
Field Summary
Fields Modifier and Type Field Description static StringENTITY_ENRICHER_NAMEprotected static com.fasterxml.jackson.databind.ObjectMapperMAPPER-
Fields inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
ctx, registry
-
-
Constructor Summary
Constructors Constructor Description AbstractJsonEnricher(String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanaccept(Class<?> clazz, Type genericType, javax.ws.rs.core.MediaType mediatype)Checks if this marshaller can handle the marshalling request.protected StringsafeReadBuffer(com.fasterxml.jackson.databind.util.TokenBuffer tb)abstract voidwrite(com.fasterxml.jackson.core.JsonGenerator jg, EntityType enriched)When implementing this method, the providedJsonGeneratorexpect you write a field name and a field value (or many).voidwrite(Enriched<EntityType> enrichable, com.fasterxml.jackson.core.JsonGenerator jg)Implement this method to writes the entity in the providedJsonGenerator.-
Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
getGenerator, write, writeEntity, writeEntity, writeEntityField, writeSerializable, writeSerializableField, writeSerializableListField, writeSerializableMapField
-
-
-
-
Field Detail
-
ENTITY_ENRICHER_NAME
public static final String ENTITY_ENRICHER_NAME
- See Also:
- Constant Field Values
-
MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper MAPPER
-
-
Constructor Detail
-
AbstractJsonEnricher
public AbstractJsonEnricher(String name)
-
-
Method Detail
-
accept
public boolean accept(Class<?> clazz, Type genericType, javax.ws.rs.core.MediaType mediatype)
Description copied from interface:MarshallerChecks 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
Supportsis compatible with mediatype. This is already done by theMarshallerRegistryThis method implementation can use injected properties. So you can check the current
RenderingContextto accept or reject a marshalling request.- Specified by:
acceptin interfaceMarshaller<EntityType>- Overrides:
acceptin classAbstractJsonWriter<Enriched<EntityType>>- 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.
-
write
public void write(Enriched<EntityType> enrichable, com.fasterxml.jackson.core.JsonGenerator jg)
Description copied from class:AbstractJsonWriterImplement this method to writes the entity in the providedJsonGenerator.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 providedJsonGenerator. It may be used is another marshaller calling this one.- Specified by:
writein classAbstractJsonWriter<Enriched<EntityType>>- Parameters:
enrichable- The entity to marshall as Json.jg- TheJsonGeneratorused to produce Json output.
-
safeReadBuffer
protected String safeReadBuffer(com.fasterxml.jackson.databind.util.TokenBuffer tb)
-
write
public abstract void write(com.fasterxml.jackson.core.JsonGenerator jg, EntityType enriched) throws IOExceptionWhen implementing this method, the providedJsonGeneratorexpect you write a field name and a field value (or many).- Parameters:
jg- TheJsonGeneratorto use.enriched- The enriched entity.- Throws:
IOException- Since:
- 7.2
-
-