public class MappingCosmosConverter extends Object implements org.springframework.data.convert.EntityConverter<CosmosPersistentEntity<?>,CosmosPersistentProperty,Object,JsonNode>, org.springframework.context.ApplicationContextAware
| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.core.convert.support.GenericConversionService |
conversionService |
protected org.springframework.data.mapping.context.MappingContext<? extends CosmosPersistentEntity<?>,CosmosPersistentProperty> |
mappingContext |
| Constructor and Description |
|---|
MappingCosmosConverter(org.springframework.data.mapping.context.MappingContext<? extends CosmosPersistentEntity<?>,CosmosPersistentProperty> mappingContext,
ObjectMapper objectMapper)
Initialization
|
| Modifier and Type | Method and Description |
|---|---|
org.springframework.context.ApplicationContext |
getApplicationContext()
To get application context
|
org.springframework.core.convert.ConversionService |
getConversionService() |
org.springframework.data.mapping.context.MappingContext<? extends CosmosPersistentEntity<?>,CosmosPersistentProperty> |
getMappingContext()
To get mapping context
|
<R> R |
read(Class<R> type,
JsonNode jsonNode) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
static Object |
toCosmosDbValue(Object fromPropertyValue)
Convert a property value to the value stored in CosmosDB
|
void |
write(Object source,
JsonNode sink) |
JsonNode |
writeJsonNode(Object sourceEntity)
To write source entity as a cosmos item
|
protected final org.springframework.data.mapping.context.MappingContext<? extends CosmosPersistentEntity<?>,CosmosPersistentProperty> mappingContext
protected org.springframework.core.convert.support.GenericConversionService conversionService
public MappingCosmosConverter(org.springframework.data.mapping.context.MappingContext<? extends CosmosPersistentEntity<?>,CosmosPersistentProperty> mappingContext, @Qualifier(value="cosmosObjectMapper") ObjectMapper objectMapper)
mappingContext - must not be nullobjectMapper - must not be nullpublic <R> R read(Class<R> type, JsonNode jsonNode)
read in interface org.springframework.data.convert.EntityReader<T,S>public void write(Object source, JsonNode sink)
write in interface org.springframework.data.convert.EntityWriter<T,S>public JsonNode writeJsonNode(Object sourceEntity)
sourceEntity - must not be nullorg.springframework.data.mapping.MappingException - no mapping metadata for entity typeCosmosAccessException - fail to map document valuepublic org.springframework.context.ApplicationContext getApplicationContext()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext in interface org.springframework.context.ApplicationContextAwarepublic org.springframework.core.convert.ConversionService getConversionService()
getConversionService in interface org.springframework.data.convert.EntityConverter<CosmosPersistentEntity<?>,CosmosPersistentProperty,Object,JsonNode>public org.springframework.data.mapping.context.MappingContext<? extends CosmosPersistentEntity<?>,CosmosPersistentProperty> getMappingContext()
getMappingContext in interface org.springframework.data.convert.EntityConverter<CosmosPersistentEntity<?>,CosmosPersistentProperty,Object,JsonNode>Copyright © 2021 Microsoft Corporation. All rights reserved.