public interface MongoConverter extends EntityConverter<MongoPersistentEntity<?>,MongoPersistentProperty,Object,org.bson.conversions.Bson>, MongoWriter<Object>, EntityReader<Object,org.bson.conversions.Bson>
MongoWriter
and EntityReader
.Modifier and Type | Method and Description |
---|---|
default Object |
convertId(Object id,
Class<?> targetType)
Converts the given raw id value into either
ObjectId or String . |
CustomConversions |
getCustomConversions()
Returns the
CustomConversions for this converter. |
ProjectionFactory |
getProjectionFactory()
Returns the
ProjectionFactory for this converter. |
MongoTypeMapper |
getTypeMapper()
Returns the
TypeMapper being used to write type information into Document s created with that
converter. |
default <S,T> T |
mapValueToTargetType(S source,
Class<T> targetType,
DbRefResolver dbRefResolver)
Mapping function capable of converting values into a desired target type by eg. extracting the actual java type
from a given
BsonValue . |
<R> R |
project(EntityProjection<R,?> descriptor,
org.bson.conversions.Bson bson)
Apply a projection to
Bson and return the projection return type R . |
getConversionService, getMappingContext
read
convertToMongoType, convertToMongoType, convertToMongoType, toDBRef, toDocumentPointer
write
MongoTypeMapper getTypeMapper()
TypeMapper
being used to write type information into Document
s created with that
converter.ProjectionFactory getProjectionFactory()
ProjectionFactory
for this converter.CustomConversions getCustomConversions()
CustomConversions
for this converter.<R> R project(EntityProjection<R,?> descriptor, org.bson.conversions.Bson bson)
Bson
and return the projection return type R
.
Non-projecting
descriptors fall back to regular
object materialization
.R
- descriptor
- the projection descriptor, must not be null.bson
- must not be null.R
.@Nullable default <S,T> T mapValueToTargetType(S source, Class<T> targetType, DbRefResolver dbRefResolver)
BsonValue
.S
- T
- targetType
- must not be null.dbRefResolver
- must not be null.Function
.IllegalArgumentException
- if targetType is null.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.