Interface MongoTypeMapper

All Superinterfaces:
TypeMapper<org.bson.conversions.Bson>
All Known Implementing Classes:
DefaultMongoTypeMapper

public interface MongoTypeMapper extends TypeMapper<org.bson.conversions.Bson>
Mongo-specific TypeMapper exposing that Documents might contain a type key.
Since:
1.0
Author:
Oliver Gierke, Christoph Strobl
  • Method Details

    • isTypeKey

      boolean isTypeKey(String key)
      Returns whether the given key is the type key.
      Returns:
    • writeTypeRestrictions

      void writeTypeRestrictions(org.bson.Document result, Set<Class<?>> restrictedTypes)
      Writes type restrictions to the given Document. 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 given restrictedTypes.
      Parameters:
      result - must not be null
      restrictedTypes - must not be null
    • getWriteTargetTypeFor

      default Class<?> getWriteTargetTypeFor(Class<?> source)
      Compute the target type for a given source considering CustomConversions.
      Parameters:
      source - the source type.
      Returns:
      never null.
      Since:
      2.2