List of usage examples for org.springframework.data.mongodb.core.convert DefaultMongoTypeMapper DEFAULT_TYPE_KEY
String DEFAULT_TYPE_KEY
To view the source code for org.springframework.data.mongodb.core.convert DefaultMongoTypeMapper DEFAULT_TYPE_KEY.
Click Source Link
From source file:org.springframework.data.mongodb.core.convert.MappingMongoConverter.java
/** * Creates a new {@link MappingMongoConverter} given the new {@link MongoDbFactory} and {@link MappingContext}. * /*from w w w . j a v a 2 s . c o m*/ * @param mongoDbFactory must not be {@literal null}. * @param mappingContext must not be {@literal null}. */ @SuppressWarnings("deprecation") public MappingMongoConverter(MongoDbFactory mongoDbFactory, MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext) { super(ConversionServiceFactory.createDefaultConversionService()); Assert.notNull(mongoDbFactory); Assert.notNull(mappingContext); this.mongoDbFactory = mongoDbFactory; this.mappingContext = mappingContext; this.typeMapper = new DefaultMongoTypeMapper(DefaultMongoTypeMapper.DEFAULT_TYPE_KEY, mappingContext); this.idMapper = new QueryMapper(this); }
From source file:org.springframework.data.mongodb.core.convert.MappingMongoConverter.java
/** * Configures the {@link MongoTypeMapper} to be used to add type information to {@link DBObject}s created by the * converter and how to lookup type information from {@link DBObject}s when reading them. Uses a * {@link DefaultMongoTypeMapper} by default. Setting this to {@literal null} will reset the {@link TypeMapper} to the * default one./*from w w w .j ava2s . co m*/ * * @param typeMapper the typeMapper to set */ public void setTypeMapper(MongoTypeMapper typeMapper) { this.typeMapper = typeMapper == null ? new DefaultMongoTypeMapper(DefaultMongoTypeMapper.DEFAULT_TYPE_KEY, mappingContext) : typeMapper; }