/** * Recursively resolve and inspect properties of given {@literal type} for indexes to be created. * * @param type * @param dotPath The {@literal "dot} path. * @param path {@link PersistentProperty} path for cycle detection. * @param collection * @param guard * @return List of {@link IndexDefinitionHolder} representing indexes for given type and its referenced property * types. Will never be {@code null}. */ private List<IndexDefinitionHolder> resolveIndexForClass(final TypeInformation<?> type, final String dotPath, final Path path, final String collection, final CycleGuard guard) { MongoPersistentEntity<?> entity = mappingContext.getRequiredPersistentEntity(type); final List<IndexDefinitionHolder> indexInformation = new ArrayList<>(); indexInformation.addAll(potentiallyCreateCompoundIndexDefinitions(dotPath, collection, entity)); entity.doWithProperties((PropertyHandler<MongoPersistentProperty>) property -> this .guradAndPotentiallyAddIndexForProperty(property, dotPath, path, collection, indexInformation, guard)); indexInformation.addAll(resolveIndexesForDbrefs(dotPath, collection, entity)); return indexInformation; }
/** * Recursively resolve and inspect properties of given {@literal type} for indexes to be created. * * @param type * @param dotPath The {@literal "dot} path. * @param path {@link PersistentProperty} path for cycle detection. * @param collection * @param guard * @return List of {@link IndexDefinitionHolder} representing indexes for given type and its referenced property * types. Will never be {@code null}. */ private List<IndexDefinitionHolder> resolveIndexForClass(final TypeInformation<?> type, final String dotPath, final Path path, final String collection, final CycleGuard guard) { MongoPersistentEntity<?> entity = mappingContext.getRequiredPersistentEntity(type); final List<IndexDefinitionHolder> indexInformation = new ArrayList<>(); indexInformation.addAll(potentiallyCreateCompoundIndexDefinitions(dotPath, collection, entity)); entity.doWithProperties((PropertyHandler<MongoPersistentProperty>) property -> this .guradAndPotentiallyAddIndexForProperty(property, dotPath, path, collection, indexInformation, guard)); indexInformation.addAll(resolveIndexesForDbrefs(dotPath, collection, entity)); return indexInformation; }