From 39e820b4bfe785e7b6be60dc743645d5e3ac3815 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Thu, 4 Jun 2015 15:20:37 -0400 Subject: [PATCH] Polish Javadoc for @ComponentScan --- .../context/annotation/ComponentScan.java | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ComponentScan.java b/spring-context/src/main/java/org/springframework/context/annotation/ComponentScan.java index 9a9e85ce5f..0ef7d37aaa 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ComponentScan.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ComponentScan.java @@ -157,16 +157,23 @@ public @interface ComponentScan { /** * The type of filter to use. *

Default is {@link FilterType#ANNOTATION}. + * @see #pattern */ FilterType type() default FilterType.ANNOTATION; /** * The class or classes to use as the filter. - *

In the case of {@link FilterType#ANNOTATION}, the class will be the - * annotation itself. In the case of {@link FilterType#ASSIGNABLE_TYPE}, - * the class will be the type that detected components should be assignable - * to. In the case of {@link FilterType#CUSTOM}, the class will be an - * implementation of {@link TypeFilter}. + *

The following table explains how the classes will be interpreted + * based on the configured value of the {@link #type} attribute. + * + * + * + * + * + * + * + * + *
{@code FilterType}Class Interpreted As
{@link FilterType#ANNOTATION ANNOTATION}the annotation itself
{@link FilterType#ASSIGNABLE_TYPE ASSIGNABLE_TYPE}the type that detected components should be assignable to
{@link FilterType#CUSTOM CUSTOM}an implementation of {@link TypeFilter}
*

When multiple classes are specified, OR logic is applied * — for example, "include types annotated with {@code @Foo} OR {@code @Bar}". *

Specifying zero classes is permitted but will have no effect on component @@ -175,13 +182,17 @@ public @interface ComponentScan { Class[] value() default {}; /** - * The String pattern (or patterns) to use for the filter, as an - * alternative to specifying a Class {@link #value}. - *

In the case of {@link FilterType#ASPECTJ}, this is an AspectJ - * type pattern expression; in the case of {@link FilterType#REGEX}, - * this is a regex pattern for the fully-qualified class names to match. + * The pattern (or patterns) to use for the filter, as an alternative + * to specifying a Class {@link #value}. + *

If {@link #type} is set to {@link FilterType#ASPECTJ ASPECTJ}, + * this is an AspectJ type pattern expression. If {@link #type} is + * set to {@link FilterType#REGEX REGEX}, this is a regex pattern + * for the fully-qualified class names to match. + * @see #type + * @see #classes */ String[] pattern() default {}; + } }