T - type to convert to/frompublic class JSONConverter<T> extends Converter<T>
This uses the Jackson JSON library to serialize / deserialize objects to JSON. The reulsting JSON is then stored in Riak.
Converter.ContentAndType, Converter.OrmExtracted| Constructor and Description |
|---|
JSONConverter(Type type)
Create a JSONConverter for creating instances of
type from
JSON and instances of RiakObject with a JSON payload from
instances of clazz |
JSONConverter(com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
| Modifier and Type | Method and Description |
|---|---|
Converter.ContentAndType |
fromDomain(T domainObject)
Provide the value portion of a RiakObject from the domain object.
|
static com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper()
Returns the
ObjectMapper being used. |
static void |
registerJacksonModule(com.fasterxml.jackson.databind.Module jacksonModule)
Convenient method to register a Jackson module into the singleton Object mapper used by domain objects.
|
T |
toDomain(BinaryValue value,
String contentType)
Convert the value portion of a RiakObject to a domain object.
|
fromDomain, newDomainInstance, toDomainpublic JSONConverter(Type type)
type from
JSON and instances of RiakObject with a JSON payload from
instances of clazztype - public JSONConverter(com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
public static com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
ObjectMapper being used.
This is a convenience method to allow changing its behavior.public static void registerJacksonModule(com.fasterxml.jackson.databind.Module jacksonModule)
jacksonModule - Module to register.public T toDomain(BinaryValue value, String contentType)
Converter
Implementations override this method to convert the value contained in
a RiakObject to an instance of a domain object.
public Converter.ContentAndType fromDomain(T domainObject)
ConverterImplementations override this method to provide the value portion of the RiakObject to be stored from the supplied domain object.
fromDomain in class Converter<T>domainObject - the domain object.Copyright © 2016. All rights reserved.