org.springframework.context.annotation

## 类 AdviceModeImportSelector<A extends Annotation>

- java.lang.Object
- - org.springframework.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).
  从以下版本开始:
    3.1
  作者:
    Chris Beams

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `static String` | `DEFAULT_ADVICE_MODE_ATTRIBUTE_NAME` The default advice mode attribute name.

  - ### 构造器概要

    构造器
    构造器和说明
    `AdviceModeImportSelector()`

  - ### 方法概要

    所有方法 实例方法 抽象方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected String` | `getAdviceModeAttributeName()` The name of the `AdviceMode` attribute for the annotation specified by the generic type `A`.
    `protected abstract String[]` | `selectImports(AdviceMode adviceMode)` Determine which classes should be imported based on the given `AdviceMode`.
    `String[]` | `selectImports(org.springframework.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`.

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 字段详细资料

    - #### 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(org.springframework.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`
      抛出:
        `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)