Module spring.data.mongodb
Class MongoPersistentEntityIndexCreator
java.lang.Object
org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator
- All Implemented Interfaces:
EventListener,ApplicationListener<MappingContextEvent<?,?>>
public class MongoPersistentEntityIndexCreator
extends Object
implements ApplicationListener<MappingContextEvent<?,?>>
Component that inspects
MongoPersistentEntity instances contained in the given MongoMappingContext
for indexing metadata and ensures the indexes to be available.- Author:
- Jon Brisbin, Oliver Gierke, Philipp Schneider, Johno Crawford, Laurent Canet, Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionMongoPersistentEntityIndexCreator(MongoMappingContext mappingContext, IndexOperationsProvider indexOperationsProvider) Creates a newMongoPersistentEntityIndexCreatorfor the givenMongoMappingContextandMongoDatabaseFactory.MongoPersistentEntityIndexCreator(MongoMappingContext mappingContext, IndexOperationsProvider indexOperationsProvider, IndexResolver indexResolver) Creates a newMongoPersistentEntityIndexCreatorfor the givenMongoMappingContextandMongoDatabaseFactory. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisIndexCreatorFor(MappingContext<?, ?> context) Returns whether the current index creator was registered for the givenMappingContext.voidonApplicationEvent(MappingContextEvent<?, ?> event) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
MongoPersistentEntityIndexCreator
public MongoPersistentEntityIndexCreator(MongoMappingContext mappingContext, IndexOperationsProvider indexOperationsProvider) Creates a newMongoPersistentEntityIndexCreatorfor the givenMongoMappingContextandMongoDatabaseFactory.- Parameters:
mappingContext- must not be null.indexOperationsProvider- must not be null.
-
MongoPersistentEntityIndexCreator
public MongoPersistentEntityIndexCreator(MongoMappingContext mappingContext, IndexOperationsProvider indexOperationsProvider, IndexResolver indexResolver) Creates a newMongoPersistentEntityIndexCreatorfor the givenMongoMappingContextandMongoDatabaseFactory.- Parameters:
mappingContext- must not be null.indexOperationsProvider- must not be null.indexResolver- must not be null.
-
-
Method Details
-
onApplicationEvent
- Specified by:
onApplicationEventin interfaceApplicationListener<MappingContextEvent<?,?>>
-
isIndexCreatorFor
Returns whether the current index creator was registered for the givenMappingContext.- Parameters:
context-- Returns:
-