Example usage for org.springframework.data.mongodb.core.convert MongoConverter getMappingContext

List of usage examples for org.springframework.data.mongodb.core.convert MongoConverter getMappingContext

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core.convert MongoConverter getMappingContext.

Prototype

MappingContext<? extends E, P> getMappingContext();

Source Link

Document

Returns the underlying MappingContext used by the converter.

Usage

From source file:com.avanza.ymer.MongoQueryFactory.java

/**
 * @param mongoConverter {@link MongoConverter} extracted from the mongo datasource used in gigaspaces
 *//*from w  ww .j a  v a2  s.c o  m*/
public MongoQueryFactory(MongoConverter mongoConverter) {
    this.mongoConverter = Objects.requireNonNull(mongoConverter);
    this.mongoMappingContext = (MongoMappingContext) mongoConverter.getMappingContext();
}

From source file:com.sangupta.jerry.mongodb.MongoTemplateBasicOperations.java

/**
 * Get the basic services from mongo template
 *///w ww . java 2  s .co  m
private synchronized void fetchMappingContextAndConversionService() {
    if (mappingContext == null) {
        MongoConverter mongoConverter = this.mongoTemplate.getConverter();
        mappingContext = mongoConverter.getMappingContext();
        conversionService = mongoConverter.getConversionService();

        MongoPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(entityClass);
        MongoPersistentProperty idProperty = persistentEntity.getIdProperty();
        this.idKey = idProperty == null ? "_id" : idProperty.getName();
    }
}