Revised indexer implementation

Issue: SPR-11890
This commit is contained in:
Juergen Hoeller
2017-01-17 12:59:42 +01:00
parent c42d44a42c
commit d96738d613
2 changed files with 20 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,21 +24,21 @@ import java.lang.annotation.Target;
/**
* Indicate that the annotated element represents a stereotype for the index.
* <p>
* The {@code CandidateComponentsIndex} is an alternative to classpath
*
* <p>The {@code CandidateComponentsIndex} is an alternative to classpath
* scanning that uses a metadata file generated at compilation time. The
* index allows retrieving the candidate components (i.e. fully qualified
* name) based on a stereotype. This annotation instructs the generator to
* index the element on which the annotated element is present or if it
* implements or extends from the annotated element. The stereotype is the
* fully qualified name of the annotated element.
* <p>
* Consider the default {@link Component} annotation that is meta-annotated
*
* <p>Consider the default {@link Component} annotation that is meta-annotated
* with this annotation. If a component is annotated with {@link Component},
* an entry for that component will be added to the index using the
* {@code org.springframework.stereotype.Component} stereotype.
* <p>
* This annotation is also honored on meta-annotations. Consider this
*
* <p>This annotation is also honored on meta-annotations. Consider this
* custom annotation:
* <pre class="code">
* package com.example;
@@ -50,13 +50,15 @@ import java.lang.annotation.Target;
* &#064;Service
* public @interface PrivilegedService { ... }
* </pre>
* If this annotation is present on an type, it will be indexed with two
*
* If the above annotation is present on a type, it will be indexed with two
* stereotypes: {@code org.springframework.stereotype.Component} and
* {@code com.example.PrivilegedService}. While {@link Service} isn't directly
* annotated with {@code Indexed}, it is meta-annotated with {@link Component}.
* <p>
* It is also possible to index all implementations of a certain interface or
* all the sub-classes of a given class by adding {@code @Indexed} on it.
*
* <p>It is also possible to index all implementations of a certain interface or
* all the subclasses of a given class by adding {@code @Indexed} on it.
*
* Consider this base interface:
* <pre class="code">
* package com.example;
@@ -64,6 +66,7 @@ import java.lang.annotation.Target;
* &#064;Indexed
* public interface AdminService { ... }
* </pre>
*
* Now, consider an implementation of this {@code AdminService} somewhere:
* <pre class="code">
* package com.example.foo;
@@ -72,13 +75,14 @@ import java.lang.annotation.Target;
*
* public class ConfigurationAdminService implements AdminService { ... }
* </pre>
*
* Because this class implements an interface that is indexed, it will be
* automatically included with the {@code com.example.AdminService} stereotype.
* If there are more {@code @Indexed} interfaces and/or super classes in the
* If there are more {@code @Indexed} interfaces and/or superclasses in the
* hierarchy, the class will map to all their stereotypes.
*
* @author Stephane Nicoll
* @since 4.3.3
* @since 5.0
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)