|
Spring Data Couchbase | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.data.couchbase.core.convert.AbstractCouchbaseConverter
org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter
public class MappingCouchbaseConverter
A mapping converter for Couchbase. The converter is responsible for reading from and writing to entities and converting it into a consumable database represenation.
| Field Summary | |
|---|---|
protected ApplicationContext |
applicationContext
The overall application context. |
protected MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> |
mappingContext
The generic mapping context. |
protected CouchbaseTypeMapper |
typeMapper
The Couchbase specific type mapper in use. |
| Fields inherited from class org.springframework.data.couchbase.core.convert.AbstractCouchbaseConverter |
|---|
conversions, conversionService, instantiators |
| Constructor Summary | |
|---|---|
MappingCouchbaseConverter(MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> mappingContext)
Create a new MappingCouchbaseConverter. |
|
| Method Summary | ||
|---|---|---|
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()
|
|
protected Object |
getValueInternal(CouchbasePersistentProperty property,
CouchbaseDocument source,
Object parent)
Loads the property value through the value provider. |
|
|
read(Class<R> clazz,
CouchbaseDocument source)
|
|
protected
|
read(CouchbasePersistentEntity<R> entity,
CouchbaseDocument source,
Object parent)
Read an incoming CouchbaseDocument into the target entity. |
|
protected
|
read(TypeInformation<R> type,
CouchbaseDocument source)
Read an incoming CouchbaseDocument into the target entity. |
|
protected
|
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 |
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. |
|
| Methods inherited from class org.springframework.data.couchbase.core.convert.AbstractCouchbaseConverter |
|---|
afterPropertiesSet, getConversionService, setCustomConversions, setInstantiators |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ApplicationContext applicationContext
protected final MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> mappingContext
protected CouchbaseTypeMapper typeMapper
| Constructor Detail |
|---|
public MappingCouchbaseConverter(MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> mappingContext)
MappingCouchbaseConverter.
mappingContext - the mapping context to use.| Method Detail |
|---|
public MappingContext<? extends CouchbasePersistentEntity<?>,CouchbasePersistentProperty> getMappingContext()
getMappingContext in interface EntityConverter<CouchbasePersistentEntity<?>,CouchbasePersistentProperty,Object,CouchbaseDocument>
public <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 ApplicationContextAware
|
Spring Data Couchbase | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||