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
Base class to convert json as
List
.
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 Json Reader
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
ConstructorDescriptionDefaultListJsonReader
(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
Modifier and TypeMethodDescriptionprotected 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 Details
-
DefaultListJsonReader
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
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 Details
-
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
-