EntityType
- The type of the element of this list.public abstract class DefaultListJsonWriter<EntityType> extends AbstractJsonWriter<List<EntityType>>
List
as json.
It follow the classic Nuxeo list format :
{
"entity-type": "GIVEN_ENTITY_TYPE",
<-- pagination info if available are here.
"entries": [
{...}, <-- A Writer
must be able to manage this format.
{...},
...
{...}
]
}
This list generates pagination information if the list is a Paginable
.
This reader delegates the marshalling of entries to the MarshallerRegistry
. A Json Writer
compatible
with the required type must be registered.
Constructor and Description |
---|
DefaultListJsonWriter(String entityType,
Class<EntityType> elClazz)
Use this constructor if the element of the list are not based on Java generic type.
|
DefaultListJsonWriter(String entityType,
Class<EntityType> elClazz,
Type elGenericType)
Use this constructor if the element of the list are based on Java generic type.
|
Modifier and Type | Method and Description |
---|---|
void |
write(List<EntityType> list,
org.codehaus.jackson.JsonGenerator jg)
Implement this method to writes the entity in the provided
JsonGenerator . |
accept, write
public DefaultListJsonWriter(String entityType, Class<EntityType> elClazz)
entityType
- The list "entity-type".elClazz
- The class of the element of the list.public DefaultListJsonWriter(String entityType, Class<EntityType> elClazz, Type elGenericType)
entityType
- The list "entity-type".elClazz
- The class of the element of the list.elGenericType
- The generic type of the list (you can use to
generate it
public void write(List<EntityType> list, org.codehaus.jackson.JsonGenerator jg) throws IOException
AbstractJsonWriter
JsonGenerator
.
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 provided JsonGenerator
. It may be used is another marshaller calling this one.
write
in class AbstractJsonWriter<List<EntityType>>
list
- The entity to marshall as Json.jg
- The JsonGenerator
used to produce Json output.IOException
Copyright © 2015 Nuxeo SA. All rights reserved.