Class AdviceModeImportSelector<A extends Annotation>
java.lang.Object
org.springframework.context.annotation.AdviceModeImportSelector<A>
- Type Parameters:
- A- annotation containing AdviceMode attribute
- All Implemented Interfaces:
- ImportSelector
- Direct Known Subclasses:
- AsyncConfigurationSelector,- CachingConfigurationSelector,- TransactionManagementConfigurationSelector
public abstract class AdviceModeImportSelector<A extends Annotation>
extends Object
implements ImportSelector
Convenient base class for 
ImportSelector implementations that select imports
 based on an AdviceMode value from an annotation (such as the @Enable*
 annotations).- Since:
- 3.1
- Author:
- Chris Beams
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected StringThe name of theAdviceModeattribute for the annotation specified by the generic typeA.protected abstract String[]selectImports(AdviceMode adviceMode) Determine which classes should be imported based on the givenAdviceMode.final 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@Configurationclass and (b) that the given annotation has an advice mode attribute of typeAdviceMode.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.annotation.ImportSelectorgetExclusionFilter
- 
Field Details- 
DEFAULT_ADVICE_MODE_ATTRIBUTE_NAMEThe default advice mode attribute name.- See Also:
 
 
- 
- 
Constructor Details- 
AdviceModeImportSelectorpublic AdviceModeImportSelector()
 
- 
- 
Method Details- 
getAdviceModeAttributeNameThe name of theAdviceModeattribute for the annotation specified by the generic typeA. The default is "mode", but subclasses may override in order to customize.
- 
selectImportsThis implementation resolves the type of annotation from generic metadata and validates that (a) the annotation is in fact present on the importing@Configurationclass and (b) that the given annotation has an advice mode attribute of typeAdviceMode.The selectImports(AdviceMode)method is then invoked, allowing the concrete implementation to choose imports in a safe and convenient fashion.- Specified by:
- selectImportsin interface- ImportSelector
- Returns:
- the class names, or an empty array if none
- Throws:
- IllegalArgumentException- if expected annotation- Ais not present on the importing- @Configurationclass or if- selectImports(AdviceMode)returns- null
 
- 
selectImportsDetermine which classes should be imported based on the givenAdviceMode.Returning nullfrom this method indicates that theAdviceModecould not be handled or was unknown and that anIllegalArgumentExceptionshould be thrown.- Parameters:
- adviceMode- the value of the advice mode attribute for the annotation specified via generics.
- Returns:
- array containing classes to import (empty array if none;
 nullif the givenAdviceModeis unknown)
 
 
-