你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
MappingCosmosConverter Class
- java.
lang. Object - com.
azure. spring. data. cosmos. core. convert. MappingCosmosConverter
- com.
Implements
public class MappingCosmosConverter
implements org.springframework.data.convert.EntityConverter<CosmosPersistentEntity<?>,CosmosPersistentProperty,Object,com.fasterxml.jackson.databind.JsonNode>, org.springframework.context.ApplicationContextAware
A converter class between common types and cosmosItemProperties
Field Summary
Modifier and Type | Field and Description |
---|---|
protected org.springframework.core.convert.support.GenericConversionService |
conversionService
Generic conversion service |
protected final
org.springframework.data.mapping.context.MappingContext<<?>,Cosmos |
mappingContext
Mapping context |
Constructor Summary
Constructor | Description |
---|---|
MappingCosmosConverter(MappingContext<? extends CosmosPersistentEntity<?>,CosmosPersistentProperty> mappingContext, ObjectMapper objectMapper) |
Initialization |
Method Summary
Modifier and Type | Method and Description |
---|---|
R | read(Class<R> type, JsonNode jsonNode) |
List<String> |
getTransientFields(T objectToSave, CosmosEntityInformation<T,?> entityInfo)
To get transient fields |
Map<Field,Object> |
getTransientFieldsMap(T object, List<String> transientFields)
To get transient fields and their values |
com.fasterxml.jackson.databind.JsonNode |
repopulateTransientFields(JsonNode responseItem, Map<Field,Object> transientValues)
To repopulate any transient fields that were stripped from the original object |
com.fasterxml.jackson.databind.JsonNode |
writeJsonNode(Object sourceEntity, List<String> transientFields)
To write source entity as a cosmos item |
org.springframework.context.ApplicationContext |
getApplicationContext()
To get application context |
org.springframework.core.convert.ConversionService | getConversionService() |
org.springframework.data.mapping.context.MappingContext<<?>,Cosmos |
getMappingContext()
To get mapping context |
void | setApplicationContext(ApplicationContext applicationContext) |
static Object |
toCosmosDbValue(Object fromPropertyValue)
Convert a property value to the value stored in CosmosDB |
void | write(Object source, JsonNode sink) |
com.fasterxml.jackson.databind.JsonNode |
writeJsonNode(Object sourceEntity)
To write source entity as a cosmos item |
Methods inherited from java.lang.Object
Field Details
conversionService
protected GenericConversionService conversionService
Generic conversion service
mappingContext
protected final MappingContext,CosmosPersistentProperty> mappingContext
Mapping context
Constructor Details
MappingCosmosConverter
public MappingCosmosConverter(MappingContext,CosmosPersistentProperty> mappingContext, ObjectMapper objectMapper)
Initialization
Parameters:
Method Details
read
public R
Parameters:
getTransientFields
public List
To get transient fields
Parameters:
Returns:
getTransientFieldsMap
public Map
To get transient fields and their values
Parameters:
Returns:
repopulateTransientFields
public JsonNode
To repopulate any transient fields that were stripped from the original object
Parameters:
Returns:
writeJsonNode
public JsonNode
To write source entity as a cosmos item
Parameters:
Returns:
getApplicationContext
public ApplicationContext getApplicationContext()
To get application context
Returns:
getConversionService
public ConversionService getConversionService()
getMappingContext
public MappingContext,CosmosPersistentProperty> getMappingContext()
To get mapping context
Returns:
setApplicationContext
public void setApplicationContext(ApplicationContext applicationContext)
Parameters:
toCosmosDbValue
public static Object toCosmosDbValue(Object fromPropertyValue)
Convert a property value to the value stored in CosmosDB
Parameters:
Returns:
write
public void write(Object source, JsonNode sink)
Parameters:
writeJsonNode
public JsonNode writeJsonNode(Object sourceEntity)
To write source entity as a cosmos item
Parameters:
Returns: