org.springframework.context.index

## Class CandidateComponentsIndex

- java.lang.Object
- - org.springframework.context.index.CandidateComponentsIndex

-     public class CandidateComponentsIndex
      extends Object

  Provide access to the candidates that are defined in `META-INF/spring.components`.

  An arbitrary number of stereotypes can be registered (and queried) on the index: a typical example is the fully qualified name of an annotation that flags the class for a certain use case. The following call returns all the `@Component` candidate types for the `com.example` package (and its sub-packages):

       Set<String> candidates = index.getCandidateTypes(
               "com.example", "org.springframework.stereotype.Component");

  The `type` is usually the fully qualified name of a class, though this is not a rule. Similarly, the `stereotype` is usually the fully qualified name of a target type but it can be any marker really.

  Since:
    5.0
  Author:
    Stephane Nicoll

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<String>` | `getCandidateTypes(String basePackage, String stereotype)` Return the candidate types that are associated with the specified stereotype.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getCandidateTypes

          public Set<String> getCandidateTypes(String basePackage,
                                               String stereotype)

      Return the candidate types that are associated with the specified stereotype.
      Parameters:
        `basePackage` - the package to check for candidates
        `stereotype` - the stereotype to use
      Returns:
        the candidate types associated with the specified `stereotype` or an empty set if none has been found for the specified `basePackage`