/** * Create {@link IndexDefinition} wrapped in {@link IndexDefinitionHolder} for {@link CompoundIndexes} of given type. * * @param dotPath The properties {@literal "dot"} path representation from its document root. * @param fallbackCollection * @param type * @return */ protected List<IndexDefinitionHolder> createCompoundIndexDefinitions(String dotPath, String fallbackCollection, MongoPersistentEntity<?> entity) { List<IndexDefinitionHolder> indexDefinitions = new ArrayList<>(); CompoundIndexes indexes = entity.findAnnotation(CompoundIndexes.class); if (indexes != null) { indexDefinitions = Arrays.stream(indexes.value()) .map(index -> createCompoundIndexDefinition(dotPath, fallbackCollection, index, entity)) .collect(Collectors.toList()); } CompoundIndex index = entity.findAnnotation(CompoundIndex.class); if (index != null) { indexDefinitions.add(createCompoundIndexDefinition(dotPath, fallbackCollection, index, entity)); } return indexDefinitions; }
/** * Create {@link IndexDefinition} wrapped in {@link IndexDefinitionHolder} for {@link CompoundIndexes} of given type. * * @param dotPath The properties {@literal "dot"} path representation from its document root. * @param fallbackCollection * @param type * @return */ protected List<IndexDefinitionHolder> createCompoundIndexDefinitions(String dotPath, String fallbackCollection, MongoPersistentEntity<?> entity) { List<IndexDefinitionHolder> indexDefinitions = new ArrayList<>(); CompoundIndexes indexes = entity.findAnnotation(CompoundIndexes.class); if (indexes != null) { indexDefinitions = Arrays.stream(indexes.value()) .map(index -> createCompoundIndexDefinition(dotPath, fallbackCollection, index, entity)) .collect(Collectors.toList()); } CompoundIndex index = entity.findAnnotation(CompoundIndex.class); if (index != null) { indexDefinitions.add(createCompoundIndexDefinition(dotPath, fallbackCollection, index, entity)); } return indexDefinitions; }