Class MongoPersistentEntityIndexCreator
java.lang.Object
org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator
- All Implemented Interfaces:
EventListener
,org.springframework.context.ApplicationListener<org.springframework.data.mapping.context.MappingContextEvent<?,
?>>
public class MongoPersistentEntityIndexCreator
extends Object
implements org.springframework.context.ApplicationListener<org.springframework.data.mapping.context.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
ConstructorDescriptionMongoPersistentEntityIndexCreator
(MongoMappingContext mappingContext, IndexOperationsProvider indexOperationsProvider) Creates a newMongoPersistentEntityIndexCreator
for the givenMongoMappingContext
andMongoDatabaseFactory
.MongoPersistentEntityIndexCreator
(MongoMappingContext mappingContext, IndexOperationsProvider indexOperationsProvider, IndexResolver indexResolver) Creates a newMongoPersistentEntityIndexCreator
for the givenMongoMappingContext
andMongoDatabaseFactory
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isIndexCreatorFor
(org.springframework.data.mapping.context.MappingContext<?, ?> context) Returns whether the current index creator was registered for the givenMappingContext
.void
onApplicationEvent
(org.springframework.data.mapping.context.MappingContextEvent<?, ?> event)
-
Constructor Details
-
MongoPersistentEntityIndexCreator
public MongoPersistentEntityIndexCreator(MongoMappingContext mappingContext, IndexOperationsProvider indexOperationsProvider) Creates a newMongoPersistentEntityIndexCreator
for the givenMongoMappingContext
andMongoDatabaseFactory
.- Parameters:
mappingContext
- must not be null.indexOperationsProvider
- must not be null.
-
MongoPersistentEntityIndexCreator
public MongoPersistentEntityIndexCreator(MongoMappingContext mappingContext, IndexOperationsProvider indexOperationsProvider, IndexResolver indexResolver) Creates a newMongoPersistentEntityIndexCreator
for the givenMongoMappingContext
andMongoDatabaseFactory
.- Parameters:
mappingContext
- must not be null.indexOperationsProvider
- must not be null.indexResolver
- must not be null.
-
-
Method Details
-
onApplicationEvent
public void onApplicationEvent(org.springframework.data.mapping.context.MappingContextEvent<?, ?> event) - Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<org.springframework.data.mapping.context.MappingContextEvent<?,
?>>
-
isIndexCreatorFor
public boolean isIndexCreatorFor(org.springframework.data.mapping.context.MappingContext<?, ?> context) Returns whether the current index creator was registered for the givenMappingContext
.- Parameters:
context
-- Returns:
-