public class GenericMapper extends AbstractMapper
A generic NitriteMapper
implementation. It uses
a MapperFacade
implementation to convert an object into a
Nitrite Document
.
Constructor and Description |
---|
GenericMapper(MapperFacade facade)
Instantiate a new
GenericMapper with a
MapperFacade instance. |
Modifier and Type | Method and Description |
---|---|
<T> Document |
asDocumentInternal(T object)
A child class must override this method for vendor specific
serialization.
|
<T> T |
asObjectInternal(Document document,
java.lang.Class<T> type)
A child class must override this method for vendor specific
de-serialization.
|
java.lang.Object |
asValue(java.lang.Object object)
Tries to convert an
object to a value type, which will be stored in
the document. |
MapperFacade |
getMapperFacade()
Gets the underlying
MapperFacade instance to configure. |
boolean |
isValueType(java.lang.Object object)
Determines if an object would be stored as a value type.
|
asDocument, asObject
public GenericMapper(MapperFacade facade)
Instantiate a new GenericMapper
with a
MapperFacade
instance.
facade
- a MapperFacade
implementationpublic <T> Document asDocumentInternal(T object)
AbstractMapper
A child class must override this method for vendor specific serialization.
asDocumentInternal
in class AbstractMapper
T
- the type parameterobject
- the objectpublic <T> T asObjectInternal(Document document, java.lang.Class<T> type)
AbstractMapper
A child class must override this method for vendor specific de-serialization.
asObjectInternal
in class AbstractMapper
T
- the type parameterdocument
- the documenttype
- the typepublic boolean isValueType(java.lang.Object object)
NitriteMapper
Determines if an object would be stored as a value type.
object
- the object to checktrue
of object
would be stored as a value type; false
otherwise.public java.lang.Object asValue(java.lang.Object object)
NitriteMapper
Tries to convert an object
to a value type, which will be stored in
the document.
As an example, a Date object is stored
as a Long value in the document. This operation
will return the long value of a Date object.
|
object
- the object to convertpublic MapperFacade getMapperFacade()
Gets the underlying MapperFacade
instance to configure.