/** * Find and create {@link IndexDefinition}s for properties of given {@link TypeInformation}. {@link IndexDefinition}s * are created for properties and types with {@link Indexed}, {@link CompoundIndexes} or {@link GeoSpatialIndexed}. * * @param entityType * @return Empty {@link Iterable} in case no {@link IndexDefinition} could be resolved for type. * @see 2.2 */ default Iterable<? extends IndexDefinition> resolveIndexFor(Class<?> entityType) { return resolveIndexFor(ClassTypeInformation.from(entityType)); }
private Mono<Void> checkForAndCreateIndexes(MongoPersistentEntity<?> entity) { List<Mono<?>> publishers = new ArrayList<>(); if (entity.isAnnotationPresent(Document.class)) { for (IndexDefinition indexDefinition : indexResolver.resolveIndexFor(entity.getTypeInformation())) { IndexDefinitionHolder indexToCreate = indexDefinition instanceof IndexDefinitionHolder ? (IndexDefinitionHolder) indexDefinition : new IndexDefinitionHolder("", indexDefinition, entity.getCollection()); publishers.add(createIndex(indexToCreate)); } } return publishers.isEmpty() ? Mono.empty() : Flux.merge(publishers).then(); }
private void checkForAndCreateIndexes(MongoPersistentEntity<?> entity) { if (entity.isAnnotationPresent(Document.class)) { for (IndexDefinition indexDefinition : indexResolver.resolveIndexFor(entity.getTypeInformation())) { JustOnceLogger.logWarnIndexCreationConfigurationChange(this.getClass().getName()); IndexDefinitionHolder indexToCreate = indexDefinition instanceof IndexDefinitionHolder ? (IndexDefinitionHolder) indexDefinition : new IndexDefinitionHolder("", indexDefinition, entity.getCollection()); createIndex(indexToCreate); } } }
private Mono<Void> checkForAndCreateIndexes(MongoPersistentEntity<?> entity) { List<Mono<?>> publishers = new ArrayList<>(); if (entity.isAnnotationPresent(Document.class)) { for (IndexDefinitionHolder indexToCreate : indexResolver.resolveIndexFor(entity.getTypeInformation())) { publishers.add(createIndex(indexToCreate)); } } return publishers.isEmpty() ? Mono.empty() : Flux.merge(publishers).then(); }
private void checkForAndCreateIndexes(MongoPersistentEntity<?> entity) { if (entity.isAnnotationPresent(Document.class)) { for (IndexDefinitionHolder indexToCreate : indexResolver.resolveIndexFor(entity.getTypeInformation())) { createIndex(indexToCreate); } } }