org.springframework.data.document.mongodb.mapping
Class MongoPersistentEntityIndexCreator
java.lang.Object
org.springframework.data.document.mongodb.mapping.MongoPersistentEntityIndexCreator
- All Implemented Interfaces:
- EventListener, ApplicationListener<org.springframework.data.mapping.event.MappingContextEvent>
public class MongoPersistentEntityIndexCreator
- extends Object
- implements ApplicationListener<org.springframework.data.mapping.event.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
Method Summary |
protected void |
checkForIndexes(MongoPersistentEntity<?> entity)
|
protected void |
ensureGeoIndex(String collection,
String name,
int min,
int max,
int bits)
|
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 event)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MongoPersistentEntityIndexCreator
public MongoPersistentEntityIndexCreator(MongoMappingContext mappingContext,
MongoTemplate mongoTemplate)
onApplicationEvent
public void onApplicationEvent(org.springframework.data.mapping.event.MappingContextEvent event)
- Specified by:
onApplicationEvent
in interface ApplicationListener<org.springframework.data.mapping.event.MappingContextEvent>
checkForIndexes
protected void checkForIndexes(MongoPersistentEntity<?> entity)
ensureIndex
protected void ensureIndex(String collection,
String name,
String def,
IndexDirection direction,
boolean unique,
boolean dropDups,
boolean sparse)
ensureGeoIndex
protected void ensureGeoIndex(String collection,
String name,
int min,
int max,
int bits)
Copyright © 2011. All Rights Reserved.