T
- the type to convert topublic abstract class Converter<T> extends Object
Subclasses will override the fromDomain(java.lang.Object)
and
fromDomain(java.lang.Object)
methods to convert the value portion
of a RiakObject
to a domain object.
Modifier and Type | Class and Description |
---|---|
protected class |
Converter.ContentAndType |
static class |
Converter.OrmExtracted
Encapsulation of ORM data extracted from a domain object.
|
Modifier and Type | Method and Description |
---|---|
abstract Converter.ContentAndType |
fromDomain(T domainObject)
Provide the value portion of a RiakObject from the domain object.
|
Converter.OrmExtracted |
fromDomain(T domainObject,
Namespace namespace,
BinaryValue key)
Convert from a domain object to a RiakObject.
|
protected T |
newDomainInstance() |
abstract T |
toDomain(BinaryValue value,
String contentType)
Convert the value portion of a RiakObject to a domain object.
|
T |
toDomain(RiakObject obj,
Location location)
Converts from a RiakObject to a domain object.
|
protected final Type type
public Converter(Type type)
protected final T newDomainInstance()
public T toDomain(RiakObject obj, Location location)
obj
- the RiakObject to be convertedlocation
- The location of this RiakObject in Riakpublic abstract T toDomain(BinaryValue value, String contentType) throws ConversionException
Implementations override this method to convert the value contained in
a RiakObject
to an instance of a domain object.
value
- the value portion of a RiakObject to convert to a domain objectcontentType
- The content type of the RiakObjectConversionException
public Converter.OrmExtracted fromDomain(T domainObject, Namespace namespace, BinaryValue key)
The domain object itself may be completely annotated with everything
required to produce a RiakObject except for the value portion.
This will prefer annotated
items over the Location
passed in.
domainObject
- a domain object to be stored in Riak.namespace
- the namespace in Riakkey
- the key for the objectpublic abstract Converter.ContentAndType fromDomain(T domainObject) throws ConversionException
Implementations override this method to provide the value portion of the RiakObject to be stored from the supplied domain object.
domainObject
- the domain object.ConversionException
Copyright © 2016. All rights reserved.