Interface IndexResolver
- All Known Implementing Classes:
MongoPersistentEntityIndexResolver
public interface IndexResolver
IndexResolver finds those IndexDefinitions to be created for a given class.
The IndexResolver considers index annotations like Indexed, GeoSpatialIndexed,
HashIndexed, TextIndexed and WildcardIndexed on properties as well as CompoundIndex
and WildcardIndexed on types.
Unless specified otherwise the index name will be created out of the keys/path involved in the index.
TextIndexed properties are collected into a single index that covers the detected fields.
Map like structures, unless annotated with WildcardIndexed, are skipped because the
map key, which cannot be resolved from static metadata, needs to be part of the
index.
- Since:
- 1.5
- Author:
- Christoph Strobl, Thomas Darimont, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionstatic IndexResolvercreate(MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext) Creates a newIndexResolvergivenMongoMappingContext.default Iterable<? extends IndexDefinition> resolveIndexFor(Class<?> entityType) Find and createIndexDefinitions for properties of givenTypeInformation.Iterable<? extends IndexDefinition> resolveIndexFor(org.springframework.data.core.TypeInformation<?> typeInformation) Find and createIndexDefinitions for properties of givenTypeInformation.
-
Method Details
-
create
static IndexResolver create(MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext) Creates a newIndexResolvergivenMongoMappingContext.- Parameters:
mappingContext- must not be null.- Returns:
- the new
IndexResolver. - Since:
- 2.2
-
resolveIndexFor
Iterable<? extends IndexDefinition> resolveIndexFor(org.springframework.data.core.TypeInformation<?> typeInformation) Find and createIndexDefinitions for properties of givenTypeInformation.IndexDefinitions are created for properties and types withIndexed,CompoundIndexesorGeoSpatialIndexed.- Parameters:
typeInformation- must not be null.- Returns:
- Empty
Iterablein case noIndexDefinitioncould be resolved for type.
-
resolveIndexFor
Find and createIndexDefinitions for properties of givenTypeInformation.IndexDefinitions are created for properties and types withIndexed,CompoundIndexesorGeoSpatialIndexed.- Parameters:
entityType- must not be null.- Returns:
- Empty
Iterablein case noIndexDefinitioncould be resolved for type.
-