public class MappingCouchbaseConverter extends AbstractCouchbaseConverter implements ApplicationContextAware
| Modifier and Type | Field and Description |
|---|---|
protected ApplicationContext |
applicationContext
The overall application context.
|
protected MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> |
mappingContext
The generic mapping context.
|
static String |
TYPEKEY_DEFAULT
The default "type key", the name of the field that will hold type information.
|
static String |
TYPEKEY_SYNCGATEWAY_COMPATIBLE
A "type key" (the name of the field that will hold type information) that is
compatible with Sync Gateway (which doesn't allows underscores).
|
protected CouchbaseTypeMapper |
typeMapper
The Couchbase specific type mapper in use.
|
conversions, conversionService, instantiators| Constructor and Description |
|---|
MappingCouchbaseConverter(MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> mappingContext)
Create a new
MappingCouchbaseConverter. |
MappingCouchbaseConverter(MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> mappingContext,
String typeKey)
Create a new
MappingCouchbaseConverter that will store class name for
complex types in the typeKey attribute. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCustomTypeKeyIfNecessary(TypeInformation<?> type,
Object source,
CouchbaseDocument target)
Add a custom type key if needed.
|
protected void |
copyCouchbaseDocument(CouchbaseDocument source,
CouchbaseDocument target)
Helper method to copy the internals from a source document into a target document.
|
MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> |
getMappingContext() |
String |
getTypeKey() |
protected Object |
getValueInternal(CouchbasePersistentProperty property,
CouchbaseDocument source,
Object parent)
Loads the property value through the value provider.
|
<R> R |
read(Class<R> clazz,
CouchbaseDocument source) |
protected <R> R |
read(CouchbasePersistentEntity<R> entity,
CouchbaseDocument source,
Object parent)
Read an incoming
CouchbaseDocument into the target entity. |
protected <R> R |
read(TypeInformation<R> type,
CouchbaseDocument source)
Read an incoming
CouchbaseDocument into the target entity. |
protected <R> R |
read(TypeInformation<R> type,
CouchbaseDocument source,
Object parent)
Read an incoming
CouchbaseDocument into the target entity. |
protected Map<Object,Object> |
readMap(TypeInformation<?> type,
CouchbaseDocument source,
Object parent)
Recursively parses the a map from the source document.
|
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setEnableStrictFieldChecking(boolean enableStrictFieldChecking)
Toggles strict checking of the couchbase
Field annotation. |
void |
write(Object source,
CouchbaseDocument target) |
protected void |
writeInternal(Object source,
CouchbaseDocument target,
CouchbasePersistentEntity<?> entity)
Internal helper method to write the source object into the target document.
|
protected void |
writeInternal(Object source,
CouchbaseDocument target,
TypeInformation<?> typeHint)
Convert a source object into a
CouchbaseDocument target. |
afterPropertiesSet, convertForWriteIfNeeded, getConversionService, getWriteClassFor, setCustomConversions, setInstantiatorspublic static final String TYPEKEY_DEFAULT
public static final String TYPEKEY_SYNCGATEWAY_COMPATIBLE
protected ApplicationContext applicationContext
protected final MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> mappingContext
protected CouchbaseTypeMapper typeMapper
public MappingCouchbaseConverter(MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> mappingContext)
MappingCouchbaseConverter.mappingContext - the mapping context to use.public MappingCouchbaseConverter(MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> mappingContext, String typeKey)
MappingCouchbaseConverter that will store class name for
complex types in the typeKey attribute.mappingContext - the mapping context to use.typeKey - the attribute name to use to store complex types class name.public MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> getMappingContext()
getMappingContext in interface EntityConverter<CouchbasePersistentEntity<?>,CouchbasePersistentProperty,Object,CouchbaseDocument>public String getTypeKey()
getTypeKey in interface CouchbaseConverterpublic void setEnableStrictFieldChecking(boolean enableStrictFieldChecking)
Field annotation. If enabled,
strict checking will prevent non-annotated properties to be serialized. This only
applies to the Couchbase datastore, allowing other Spring Data datastores to still
deal with the property.enableStrictFieldChecking - true to only consider Field-annotated properties for
Couchbase serialization.DATACOUCH-226public <R> R read(Class<R> clazz, CouchbaseDocument source)
read in interface EntityReader<Object,CouchbaseDocument>protected <R> R read(TypeInformation<R> type, CouchbaseDocument source)
CouchbaseDocument into the target entity.R - the entity type.type - the type information of the target entity.source - the document to convert.protected <R> R read(TypeInformation<R> type, CouchbaseDocument source, Object parent)
CouchbaseDocument into the target entity.R - the entity type.type - the type information of the target entity.source - the document to convert.parent - an optional parent object.protected <R> R read(CouchbasePersistentEntity<R> entity, CouchbaseDocument source, Object parent)
CouchbaseDocument into the target entity.R - the entity type.entity - the target entity.source - the document to convert.parent - an optional parent object.protected Object getValueInternal(CouchbasePersistentProperty property, CouchbaseDocument source, Object parent)
property - the source property.source - the source document.parent - the optional parent.protected Map<Object,Object> readMap(TypeInformation<?> type, CouchbaseDocument source, Object parent)
type - the type information for the document.source - the source document.parent - the optional parent.public void write(Object source, CouchbaseDocument target)
write in interface EntityWriter<Object,CouchbaseDocument>protected void writeInternal(Object source, CouchbaseDocument target, TypeInformation<?> typeHint)
CouchbaseDocument target.source - the source object.target - the target document.typeHint - the type information for the source.protected void copyCouchbaseDocument(CouchbaseDocument source, CouchbaseDocument target)
source - the source document.target - the target document.protected void writeInternal(Object source, CouchbaseDocument target, CouchbasePersistentEntity<?> entity)
source - the source object.target - the target document.entity - the persistent entity to convert from.protected void addCustomTypeKeyIfNecessary(TypeInformation<?> type, Object source, CouchbaseDocument target)
type - the type information.source - th the source object.target - the target document.public void setApplicationContext(ApplicationContext applicationContext)
setApplicationContext in interface ApplicationContextAwareCopyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.