Module spring.data.mongodb
Interface MappingMongoConverter.ConversionContext
- All Known Implementing Classes:
MappingMongoConverter.DefaultConversionContext
- Enclosing class:
- MappingMongoConverter
protected static interface MappingMongoConverter.ConversionContext
Conversion context defining an interface for graph-traversal-based conversion of documents. Entrypoint for
recursive conversion of
Document and other types.- Since:
- 3.4.3
-
Method Summary
Modifier and TypeMethodDescriptiondefault <S> Sconvert(Object source, TypeInformation<? extends S> typeHint) Converts a source object intotarget.<S> Sconvert(Object source, TypeInformation<? extends S> typeHint, MappingMongoConverter.ConversionContext context) Converts a source object intotarget.default <S> SfindContextualEntity(MongoPersistentEntity<S> entity, org.bson.Document document) Lookup a potentially existing entity instance of the givenMongoPersistentEntityandDocumentforProperty(String name) Obtain aMappingMongoConverter.ConversionContextfor the given propertyname.forProperty(MongoPersistentProperty property) Obtain aMappingMongoConverter.ConversionContextfor the givenMongoPersistentProperty.getPath()withPath(ObjectPath currentPath) Create a newMappingMongoConverter.ConversionContextwithcurrentPathapplied.
-
Method Details
-
convert
Converts a source object intotarget.- Parameters:
source- must not be null.typeHint- must not be null.- Returns:
- the converted object.
-
convert
<S> S convert(Object source, TypeInformation<? extends S> typeHint, MappingMongoConverter.ConversionContext context) Converts a source object intotarget.- Parameters:
source- must not be null.typeHint- must not be null.context- must not be null.- Returns:
- the converted object.
-
withPath
Create a newMappingMongoConverter.ConversionContextwithcurrentPathapplied.- Parameters:
currentPath- must not be null.- Returns:
- a new
MappingMongoConverter.ConversionContextwithcurrentPathapplied.
-
forProperty
Obtain aMappingMongoConverter.ConversionContextfor the given propertyname.- Parameters:
name- must not be null.- Returns:
- the
MappingMongoConverter.ConversionContextto be used for conversion of the given property.
-
forProperty
Obtain aMappingMongoConverter.ConversionContextfor the givenMongoPersistentProperty.- Parameters:
property- must not be null.- Returns:
- the
MappingMongoConverter.ConversionContextto be used for conversion of the given property.
-
findContextualEntity
@Nullable default <S> S findContextualEntity(MongoPersistentEntity<S> entity, org.bson.Document document) Lookup a potentially existing entity instance of the givenMongoPersistentEntityandDocument- Type Parameters:
S-- Parameters:
entity-document-- Returns:
-
getPath
ObjectPath getPath() -
getCustomConversions
CustomConversions getCustomConversions() -
getSourceConverter
MongoConverter getSourceConverter()
-