Class DefaultListJsonReader<EntityType>
- java.lang.Object
-
- org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader<EntityType>
-
- org.nuxeo.ecm.core.io.marshallers.json.EntityJsonReader<List<EntityType>>
-
- org.nuxeo.ecm.core.io.marshallers.json.DefaultListJsonReader<EntityType>
-
- Type Parameters:
EntityType
- The type of the element of this list.
- All Implemented Interfaces:
Marshaller<List<EntityType>>
,Reader<List<EntityType>>
- Direct Known Subclasses:
AnnotationListJsonReader
,CommentListJsonReader
,DirectoryEntryListJsonReader
,DocumentModelListJsonReader
,NuxeoGroupListJsonReader
,NuxeoPrincipalListJsonReader
,SavedSearchListReader
public abstract class DefaultListJsonReader<EntityType> extends EntityJsonReader<List<EntityType>>
Base class to convert json asList
.It follow the classic Nuxeo list format :
{ "entity-type": "GIVEN_ENTITY_TYPE", "entries": [ {...}, <-- A
Reader
must be able to manage this format. {...}, ... {...} ] }This reader delegates the unmarshalling of entries to the
MarshallerRegistry
. A JsonReader
compatible with the required type and the json format must be registered.- Since:
- 7.2
-
-
Field Summary
-
Fields inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader
ctx, registry
-
-
Constructor Summary
Constructors Constructor Description DefaultListJsonReader(String entityType, Class<EntityType> elClazz)
Use this constructor if the element of the list are not based on Java generic type.DefaultListJsonReader(String entityType, Class<EntityType> elClazz, Type elGenericType)
Use this constructor if the element of the list are based on Java generic type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<EntityType>
readEntity(com.fasterxml.jackson.databind.JsonNode jn)
Implement this method to read the entity.-
Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.EntityJsonReader
read
-
Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader
accept, getBooleanField, getLongField, getNode, getStringField, getStringListField, read, readEntity
-
-
-
-
Constructor Detail
-
DefaultListJsonReader
public DefaultListJsonReader(String entityType, Class<EntityType> elClazz)
Use this constructor if the element of the list are not based on Java generic type.- Parameters:
entityType
- The list "entity-type".elClazz
- The class of the element of the list.
-
DefaultListJsonReader
public DefaultListJsonReader(String entityType, Class<EntityType> elClazz, Type elGenericType)
Use this constructor if the element of the list are based on Java generic type.- Parameters:
entityType
- The list "entity-type".elClazz
- The class of the element of the list.elGenericType
- The generic type of the list (you can useto generate it
-
-
Method Detail
-
readEntity
protected List<EntityType> readEntity(com.fasterxml.jackson.databind.JsonNode jn) throws IOException
Description copied from class:EntityJsonReader
Implement this method to read the entity.- Specified by:
readEntity
in classEntityJsonReader<List<EntityType>>
- Parameters:
jn
- AJsonNode
pointing at the root of the json input.- Returns:
- The parsed entity.
- Throws:
IOException
-
-