Interface MongoTypeMapper
- All Superinterfaces:
TypeMapper<org.bson.conversions.Bson>
- All Known Implementing Classes:
DefaultMongoTypeMapper
Mongo-specific
TypeMapper
exposing that Document
s might contain a type key.- Since:
- 1.0
- Author:
- Oliver Gierke, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptiondefault Class<?>
getWriteTargetTypeFor
(Class<?> source) Compute the target type for a given source consideringCustomConversions
.boolean
Returns whether the given key is the type key.void
writeTypeRestrictions
(org.bson.Document result, Set<Class<?>> restrictedTypes) Writes type restrictions to the givenDocument
.Methods inherited from interface org.springframework.data.convert.TypeMapper
readType, readType, writeType, writeType
-
Method Details
-
isTypeKey
Returns whether the given key is the type key.- Returns:
-
writeTypeRestrictions
Writes type restrictions to the givenDocument
. This usually results in an$in
-clause to be generated that restricts the type-key (e.g._class
) to be in the set of type aliases for the givenrestrictedTypes
.- Parameters:
result
- must not be nullrestrictedTypes
- must not be null
-
getWriteTargetTypeFor
Compute the target type for a given source consideringCustomConversions
.- Parameters:
source
- the source type.- Returns:
- never null.
- Since:
- 2.2
-