public class UpdateMapper extends QueryMapper
QueryMapper that retains type information on the mongo types.QueryMapper.AssociationConverter, QueryMapper.Field, QueryMapper.MetadataBackedFieldLOGGER| Constructor and Description |
|---|
UpdateMapper(MongoConverter converter)
Creates a new
UpdateMapper using the given MongoConverter. |
| Modifier and Type | Method and Description |
|---|---|
protected QueryMapper.Field |
createPropertyField(MongoPersistentEntity<?> entity,
String key,
MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> mappingContext) |
protected Object |
delegateConvertToMongoType(Object source,
MongoPersistentEntity<?> entity)
Converts the given source object to a mongo type retaining the original type information of the source type on the
mongo type.
|
org.bson.Document |
getMappedObject(org.bson.conversions.Bson query,
MongoPersistentEntity<?> entity)
Replaces the property keys used in the given
Document with the appropriate keys by using the
PersistentEntity metadata. |
protected Map.Entry<String,Object> |
getMappedObjectForField(QueryMapper.Field field,
Object rawValue)
Extracts the mapped object value for given field out of rawValue taking nested
Keywords into account |
protected boolean |
isAssociationConversionNecessary(QueryMapper.Field documentField,
Object value)
Returns whether the given
QueryMapper.Field represents an association reference that together with the given value
requires conversion to a DBRef object. |
static boolean |
isUpdateObject(org.bson.Document updateObj)
Returns true if the given
Document is an update object that uses update operators. |
convertAssociation, convertAssociation, convertId, convertId, convertSimpleOrDocument, createMapEntry, getMappedFields, getMappedKeyword, getMappedKeyword, getMappedObject, getMappedSort, getMappedValue, getMappingContext, isDBObject, isDocument, isKeyword, isNestedKeyword, isTypeKeypublic UpdateMapper(MongoConverter converter)
UpdateMapper using the given MongoConverter.converter - must not be null.public org.bson.Document getMappedObject(org.bson.conversions.Bson query,
@Nullable
MongoPersistentEntity<?> entity)
QueryMapperDocument with the appropriate keys by using the
PersistentEntity metadata.getMappedObject in class QueryMapperquery - must not be null.entity - can be null.public static boolean isUpdateObject(@Nullable org.bson.Document updateObj)
Document is an update object that uses update operators.updateObj - can be null.Document is an update object.protected Object delegateConvertToMongoType(Object source, @Nullable MongoPersistentEntity<?> entity)
delegateConvertToMongoType in class QueryMapperQueryMapper.delegateConvertToMongoType(java.lang.Object,
org.springframework.data.mongodb.core.mapping.MongoPersistentEntity)protected Map.Entry<String,Object> getMappedObjectForField(QueryMapper.Field field, Object rawValue)
QueryMapperKeywords into accountgetMappedObjectForField in class QueryMapperprotected boolean isAssociationConversionNecessary(QueryMapper.Field documentField, @Nullable Object value)
QueryMapperQueryMapper.Field represents an association reference that together with the given value
requires conversion to a DBRef object. We check whether the
type of the given value is compatible with the type of the given document field in order to deal with potential
query field exclusions, since MongoDB uses the int 0 as an indicator for an excluded field.isAssociationConversionNecessary in class QueryMapperdocumentField - must not be null.protected QueryMapper.Field createPropertyField(MongoPersistentEntity<?> entity, String key, MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> mappingContext)
createPropertyField in class QueryMapperCopyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.