• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TAKETODAY / today-infrastructure / 18154768944

01 Oct 2025 07:26AM UTC coverage: 81.882% (-0.005%) from 81.887%
18154768944

push

github

web-flow
Merge pull request #290 from TAKETODAY/dev/jspecify

jspecify

59788 of 78013 branches covered (76.64%)

Branch coverage included in aggregate %.

141239 of 167496 relevant lines covered (84.32%)

3.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
today-context/src/main/java/infra/context/annotation/DeferredImportSelector.java
1
/*
2
 * Copyright 2017 - 2025 the original author or authors.
3
 *
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation, either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program. If not, see [https://www.gnu.org/licenses/]
16
 */
17

18
package infra.context.annotation;
19

20
import org.jspecify.annotations.Nullable;
21

22
import infra.core.Ordered;
23
import infra.core.annotation.Order;
24
import infra.core.type.AnnotationMetadata;
25

26
/**
27
 * A variation of {@link ImportSelector} that runs after all {@code @Configuration} beans
28
 * have been processed. This type of selector can be particularly useful when the selected
29
 * imports are {@code @Conditional}.
30
 *
31
 * <p>Implementations can also extend the {@link Ordered}
32
 * interface or use the {@link Order} annotation to
33
 * indicate a precedence against other {@link DeferredImportSelector DeferredImportSelectors}.
34
 *
35
 * <p>Implementations may also provide an {@link #getImportGroup() import group} which
36
 * can provide additional sorting and filtering logic across different selectors.
37
 *
38
 * @author Phillip Webb
39
 * @author Stephane Nicoll
40
 * @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
41
 * @since 4.0
42
 */
43
public interface DeferredImportSelector extends ImportSelector {
44

45
  /**
46
   * Return a specific import group.
47
   * <p>The default implementations return {@code null} for no grouping required.
48
   *
49
   * @return the import group class, or {@code null} if none
50
   */
51
  @Nullable
52
  default Class<? extends Group> getImportGroup() {
53
    return null;
2✔
54
  }
55

56
  /**
57
   * Interface used to group results from different import selectors.
58
   */
59
  interface Group {
60

61
    /**
62
     * Process the {@link AnnotationMetadata} of the importing @{@link Configuration}
63
     * class using the specified {@link DeferredImportSelector}.
64
     */
65
    void process(AnnotationMetadata metadata, DeferredImportSelector selector);
66

67
    /**
68
     * Return the {@link Entry entries} of which class(es) should be imported
69
     * for this group.
70
     */
71
    Iterable<Entry> selectImports();
72

73
    /**
74
     * An entry that holds the {@link AnnotationMetadata} of the importing
75
     * {@link Configuration} class and the class name to import.
76
     *
77
     * @param metadata Return the {@link AnnotationMetadata} of the importing
78
     * {@link Configuration} class.
79
     * @param importClassName Return the fully qualified name of the class to import.
80
     */
81
    record Entry(AnnotationMetadata metadata, String importClassName) {
9✔
82

83
      @Override
84
      public String toString() {
85
        return this.importClassName;
×
86
      }
87
    }
88
  }
89

90
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc