public abstract class AbstractMapper extends java.lang.Object implements NitriteMapper
This class provides a skeletal implementation of a NitriteMapper
.
If an object implements a Mappable
interface, it will use that
implementation to generate a Document
, otherwise it will use
vendor specific serializer implementation.
Constructor and Description |
---|
AbstractMapper() |
Modifier and Type | Method and Description |
---|---|
<T> Document |
asDocument(T object)
Converts and
object to a Document . |
protected abstract <T> Document |
asDocumentInternal(T object)
A child class must override this method for vendor specific
serialization.
|
<T> T |
asObject(Document document,
java.lang.Class<T> type)
Tries to convert a
document to an object of type T . |
protected abstract <T> T |
asObjectInternal(Document document,
java.lang.Class<T> type)
A child class must override this method for vendor specific
de-serialization.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asValue, isValueType
protected abstract <T> Document asDocumentInternal(T object)
A child class must override this method for vendor specific serialization.
T
- the type parameterobject
- the objectprotected abstract <T> T asObjectInternal(Document document, java.lang.Class<T> type)
A child class must override this method for vendor specific de-serialization.
T
- the type parameterdocument
- the documenttype
- the typepublic <T> Document asDocument(T object)
NitriteMapper
Converts and object
to a Document
.
asDocument
in interface NitriteMapper
T
- the type parameterobject
- the objectpublic <T> T asObject(Document document, java.lang.Class<T> type)
NitriteMapper
Tries to convert a document
to an object of type T
.
asObject
in interface NitriteMapper
T
- the type parameterdocument
- the documenttype
- the type of the object