Spring Data Document

org.springframework.data.mongodb.core.index
Class MongoPersistentEntityIndexCreator

java.lang.Object
  extended by org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator
All Implemented Interfaces:
EventListener, ApplicationListener<org.springframework.data.mapping.event.MappingContextEvent<MongoPersistentEntity<MongoPersistentProperty>,MongoPersistentProperty>>

public class MongoPersistentEntityIndexCreator
extends Object
implements ApplicationListener<org.springframework.data.mapping.event.MappingContextEvent<MongoPersistentEntity<MongoPersistentProperty>,MongoPersistentProperty>>

Component that inspects BasicMongoPersistentEntity instances contained in the given MongoMappingContext for indexing metadata and ensures the indexes to be available.

Author:
Jon Brisbin <[email protected]>, Oliver Gierke

Constructor Summary
MongoPersistentEntityIndexCreator(MongoMappingContext mappingContext, MongoDbFactory mongoDbFactory)
          Creats a new MongoPersistentEntityIndexCreator for the given MongoMappingContext and MongoDbFactory.
 
Method Summary
protected  void checkForIndexes(MongoPersistentEntity<?> entity)
           
protected  void ensureIndex(String collection, String name, String def, IndexDirection direction, boolean unique, boolean dropDups, boolean sparse)
           
 void onApplicationEvent(org.springframework.data.mapping.event.MappingContextEvent<MongoPersistentEntity<MongoPersistentProperty>,MongoPersistentProperty> event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MongoPersistentEntityIndexCreator

public MongoPersistentEntityIndexCreator(MongoMappingContext mappingContext,
                                         MongoDbFactory mongoDbFactory)
Creats a new MongoPersistentEntityIndexCreator for the given MongoMappingContext and MongoDbFactory.

Parameters:
mappingContext - must not be
mongoDbFactory - must not be
Method Detail

onApplicationEvent

public void onApplicationEvent(org.springframework.data.mapping.event.MappingContextEvent<MongoPersistentEntity<MongoPersistentProperty>,MongoPersistentProperty> event)
Specified by:
onApplicationEvent in interface ApplicationListener<org.springframework.data.mapping.event.MappingContextEvent<MongoPersistentEntity<MongoPersistentProperty>,MongoPersistentProperty>>

checkForIndexes

protected void checkForIndexes(MongoPersistentEntity<?> entity)

ensureIndex

protected void ensureIndex(String collection,
                           String name,
                           String def,
                           IndexDirection direction,
                           boolean unique,
                           boolean dropDups,
                           boolean sparse)

Spring Data Document

Copyright © 2012. All Rights Reserved.