类 AdviceModeImportSelector<A extends Annotation>

java.lang.Object
cn.taketoday.context.annotation.AdviceModeImportSelector<A>
类型参数:
A - annotation containing AdviceMode attribute
所有已实现的接口:
ImportSelector
直接已知子类:
AsyncConfigurationSelector, CachingConfigurationSelector

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).
从以下版本开始:
4.0
作者:
Chris Beams
  • 字段详细资料

    • DEFAULT_ADVICE_MODE_ATTRIBUTE_NAME

      public static final String DEFAULT_ADVICE_MODE_ATTRIBUTE_NAME
      The default advice mode attribute name.
      另请参阅:
  • 构造器详细资料

    • AdviceModeImportSelector

      public AdviceModeImportSelector()
  • 方法详细资料

    • getAdviceModeAttributeName

      protected String getAdviceModeAttributeName()
      The name of the AdviceMode attribute for the annotation specified by the generic type A. The default is "mode", but subclasses may override in order to customize.
    • selectImports

      public final String[] selectImports(cn.taketoday.core.type.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.

      The selectImports(AdviceMode) method is then invoked, allowing the concrete implementation to choose imports in a safe and convenient fashion.

      指定者:
      selectImports 在接口中 ImportSelector
      返回:
      the class names, or an empty array if none
      抛出:
      IllegalArgumentException - if expected annotation A is not present on the importing @Configuration class or if selectImports(AdviceMode) returns null
    • selectImports

      @Nullable protected abstract String[] selectImports(AdviceMode adviceMode)
      Determine which classes should be imported based on the given 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.
      返回:
      array containing classes to import (empty array if none; null if the given AdviceMode is unknown)