T - The type of things the list containspublic abstract class ListResource<T>
extends com.fasterxml.jackson.databind.JsonSerializable.Base
Wraps a list of items with a self-link and a custom named key
This uses a custom serializer and deserializer because the key() can be dynamically
specified. This reduces a lot of boilerplate response interfaces.
| Constructor and Description |
|---|
ListResource() |
| Modifier and Type | Method and Description |
|---|---|
static <T> ListResource<T> |
create(Link selfLink,
String key,
List<T> items) |
abstract List<T> |
items() |
abstract String |
key()
The key for the items in the serialized JSON object.
|
abstract Link |
selfLink() |
void |
serialize(com.fasterxml.jackson.core.JsonGenerator gen,
com.fasterxml.jackson.databind.SerializerProvider serializers) |
void |
serializeWithType(com.fasterxml.jackson.core.JsonGenerator gen,
com.fasterxml.jackson.databind.SerializerProvider serializers,
com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer) |
public abstract Link selfLink()
public abstract String key()
public static <T> ListResource<T> create(Link selfLink, String key, List<T> items)
public void serialize(com.fasterxml.jackson.core.JsonGenerator gen,
com.fasterxml.jackson.databind.SerializerProvider serializers)
throws IOException
IOExceptionpublic void serializeWithType(com.fasterxml.jackson.core.JsonGenerator gen,
com.fasterxml.jackson.databind.SerializerProvider serializers,
com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer)
throws IOException
IOExceptionCopyright © 2018 Grakn Labs Ltd. All rights reserved.