public class MongoPersistentEntityIndexCreator extends Object implements ApplicationListener<MappingContextEvent<MongoPersistentEntity<?>,MongoPersistentProperty>>
MongoPersistentEntity instances contained in the given MongoMappingContext
for indexing metadata and ensures the indexes to be available.| Constructor and Description |
|---|
MongoPersistentEntityIndexCreator(MongoMappingContext mappingContext,
MongoDbFactory mongoDbFactory)
Creats a new
MongoPersistentEntityIndexCreator for the given MongoMappingContext and
MongoDbFactory. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkForIndexes(MongoPersistentEntity<?> entity) |
protected void |
ensureIndex(String collection,
String name,
com.mongodb.DBObject indexDefinition,
boolean unique,
boolean dropDups,
boolean sparse)
Triggers the actual index creation.
|
boolean |
isIndexCreatorFor(MappingContext<?,?> context)
Returns whether the current index creator was registered for the given
MappingContext. |
void |
onApplicationEvent(MappingContextEvent<MongoPersistentEntity<?>,MongoPersistentProperty> event) |
public MongoPersistentEntityIndexCreator(MongoMappingContext mappingContext, MongoDbFactory mongoDbFactory)
MongoPersistentEntityIndexCreator for the given MongoMappingContext and
MongoDbFactory.mappingContext - must not be nullmongoDbFactory - must not be nullpublic void onApplicationEvent(MappingContextEvent<MongoPersistentEntity<?>,MongoPersistentProperty> event)
onApplicationEvent in interface ApplicationListener<MappingContextEvent<MongoPersistentEntity<?>,MongoPersistentProperty>>protected void checkForIndexes(MongoPersistentEntity<?> entity)
public boolean isIndexCreatorFor(MappingContext<?,?> context)
MappingContext.context - protected void ensureIndex(String collection, String name, com.mongodb.DBObject indexDefinition, boolean unique, boolean dropDups, boolean sparse)
collection - the collection to create the index inname - the name of the index about to be createdindexDefinition - the index definitionunique - whether it shall be a unique indexdropDups - whether to drop duplicatessparse - sparse or notCopyright © 2011-2013-2013 SpringSource. All Rights Reserved.