A
- annotation containing AdviceMode attributepublic abstract class AdviceModeImportSelector<A extends java.lang.annotation.Annotation> extends java.lang.Object implements ImportSelector
ImportSelector
implementations that select imports
based on an AdviceMode
value from an annotation (such as the @Enable*
annotations).Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_ADVICE_MODE_ATTRIBUTE_NAME
The default advice mode attribute name.
|
Constructor and Description |
---|
AdviceModeImportSelector() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
getAdviceModeAttributeName()
The name of the
AdviceMode attribute for the annotation specified by the
generic type A . |
protected abstract java.lang.String[] |
selectImports(AdviceMode adviceMode)
Determine which classes should be imported based on the given
AdviceMode . |
java.lang.String[] |
selectImports(AnnotationMetadata importingClassMetadata)
This implementation resolves the type of annotation from generic metadata and
validates that (a) the annotation is in fact present on the importing
@Configuration class and (b) that the given annotation has an
advice mode attribute of type
AdviceMode . |
public static final java.lang.String DEFAULT_ADVICE_MODE_ATTRIBUTE_NAME
protected java.lang.String getAdviceModeAttributeName()
AdviceMode
attribute for the annotation specified by the
generic type A
. The default is "mode",
but subclasses may override in order to customize.public final java.lang.String[] selectImports(AnnotationMetadata importingClassMetadata)
@Configuration
class and (b) that the given annotation has an
advice mode attribute of type
AdviceMode
.
The selectImports(AdviceMode)
method is then invoked, allowing the
concrete implementation to choose imports in a safe and convenient fashion.
selectImports
in interface ImportSelector
java.lang.IllegalArgumentException
- if expected annotation A
is not present
on the importing @Configuration
class or if selectImports(AdviceMode)
returns null
protected abstract java.lang.String[] selectImports(AdviceMode adviceMode)
AdviceMode
.
Returning null
from this method indicates that the AdviceMode
could not be handled or was unknown and that an IllegalArgumentException
should be thrown.
adviceMode
- the value of the advice mode attribute for the annotation specified via generics.null
if the given AdviceMode
is unknown)