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> S
convert
(Object source, TypeInformation<? extends S> typeHint) Converts a source object intotarget
.<S> S
convert
(Object source, TypeInformation<? extends S> typeHint, MappingMongoConverter.ConversionContext context) Converts a source object intotarget
.default <S> S
findContextualEntity
(MongoPersistentEntity<S> entity, org.bson.Document document) Lookup a potentially existing entity instance of the givenMongoPersistentEntity
andDocument
forProperty
(String name) Obtain aMappingMongoConverter.ConversionContext
for the given propertyname
.forProperty
(MongoPersistentProperty property) Obtain aMappingMongoConverter.ConversionContext
for the givenMongoPersistentProperty
.org.springframework.data.mongodb.core.convert.ObjectPath
getPath()
withPath
(org.springframework.data.mongodb.core.convert.ObjectPath currentPath) Create a newMappingMongoConverter.ConversionContext
withcurrentPath
applied.
-
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
MappingMongoConverter.ConversionContext withPath(org.springframework.data.mongodb.core.convert.ObjectPath currentPath) Create a newMappingMongoConverter.ConversionContext
withcurrentPath
applied.- Parameters:
currentPath
- must not be null.- Returns:
- a new
MappingMongoConverter.ConversionContext
withcurrentPath
applied.
-
forProperty
Obtain aMappingMongoConverter.ConversionContext
for the given propertyname
.- Parameters:
name
- must not be null.- Returns:
- the
MappingMongoConverter.ConversionContext
to be used for conversion of the given property.
-
forProperty
Obtain aMappingMongoConverter.ConversionContext
for the givenMongoPersistentProperty
.- Parameters:
property
- must not be null.- Returns:
- the
MappingMongoConverter.ConversionContext
to 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 givenMongoPersistentEntity
andDocument
- Type Parameters:
S
-- Parameters:
entity
-document
-- Returns:
-
getPath
org.springframework.data.mongodb.core.convert.ObjectPath getPath() -
getCustomConversions
CustomConversions getCustomConversions() -
getSourceConverter
MongoConverter getSourceConverter()
-