Top Description Inners Fields Constructors Methods
org.springframework.context.index

public Class CandidateComponentsIndex

extends Object
Class Inheritance
Annotations
@Deprecated
since:6.1
forRemoval:true
Imports
java.util.Collections, .List, .Properties, .Set, java.util.stream.Collectors, org.springframework.util.AntPathMatcher, .ClassUtils, .LinkedMultiValueMap, .MultiValueMap

Deprecated

for removal since 6.1.

as of 6.1, in favor of the AOT engine.

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.

Author
Stephane Nicoll
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final MultiValueMap<String, CandidateComponentsIndex.Entry>
private static final AntPathMatcher

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Set<String>

Returns:

the candidate types associated with the specified stereotype or an empty set if none has been found for the specified basePackage
getCandidateTypes
(String
the package to check for candidates
basePackage
,
String
the stereotype to use
stereotype
)

Return the candidate types that are associated with the specified stereotype.

private static MultiValueMap<String, CandidateComponentsIndex.Entry>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexback to summary
private final MultiValueMap<String, CandidateComponentsIndex.Entry> index
pathMatcherback to summary
private static final AntPathMatcher pathMatcher

Constructor Detail

CandidateComponentsIndexback to summary
pack-priv CandidateComponentsIndex(List<Properties> content)

Method Detail

getCandidateTypesback to summary
public Set<String> getCandidateTypes(String basePackage, String stereotype)

Return the candidate types that are associated with the specified stereotype.

Parameters
basePackage:String

the package to check for candidates

stereotype:String

the stereotype to use

Returns:Set<String>

the candidate types associated with the specified stereotype or an empty set if none has been found for the specified basePackage

parseIndexback to summary
private static MultiValueMap<String, CandidateComponentsIndex.Entry> parseIndex(List<Properties> content)
org.springframework.context.index back to summary

private Class CandidateComponentsIndex.Entry

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.context.index.CandidateComponentsIndex.Entry

Field Summary

Modifier and TypeField and Description
private final String
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
Entry(String type)

Method Summary

Modifier and TypeMethod and Description
public boolean
match(String basePackage)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

packageNameback to summary
private final String packageName
typeback to summary
private final String type

Constructor Detail

Entryback to summary
pack-priv Entry(String type)

Method Detail

matchback to summary
public boolean match(String basePackage)