org.springframework.aop

## 接口 TargetSource

- 所有超级接口:
    TargetClassAware
  所有已知实现类:
    AbstractBeanFactoryBasedTargetSource, AbstractLazyCreationTargetSource, AbstractPoolingTargetSource, AbstractPrototypeBasedTargetSource, AbstractRefreshableTargetSource, BeanFactoryRefreshableTargetSource, CommonsPool2TargetSource, EmptyTargetSource, HotSwappableTargetSource, LazyInitTargetSource, PrototypeTargetSource, SimpleBeanTargetSource, SingletonTargetSource, ThreadLocalTargetSource

      public interface TargetSource
      extends TargetClassAware

  A `TargetSource` is used to obtain the current "target" of an AOP invocation, which will be invoked via reflection if no around advice chooses to end the interceptor chain itself.

  If a `TargetSource` is "static", it will always return the same target, allowing optimizations in the AOP framework. Dynamic target sources can support pooling, hot swapping, etc.

  Application developers don't usually need to work with `TargetSources` directly: this is an AOP framework interface.

  作者:
    Rod Johnson, Juergen Hoeller

- - ### 方法概要

    所有方法 实例方法 抽象方法
    限定符和类型 | 方法和说明
    --- | ---
    `Object` | `getTarget()` Return a target instance.
    `Class<?>` | `getTargetClass()` Return the type of targets returned by this `TargetSource`.
    `boolean` | `isStatic()` Will all calls to `getTarget()` return the same object?
    `void` | `releaseTarget(Object target)` Release the given target object obtained from the `getTarget()` method, if any.

- - ### 方法详细资料

    - #### getTargetClass

          @Nullable
          Class<?> getTargetClass()

      Return the type of targets returned by this `TargetSource`.

      Can return `null`, although certain usages of a `TargetSource` might just work with a predetermined target class.

      指定者:
        `getTargetClass` 在接口中 `TargetClassAware`
      返回:
        the type of targets returned by this `TargetSource`

    - #### isStatic

          boolean isStatic()

      Will all calls to `getTarget()` return the same object?

      In that case, there will be no need to invoke `releaseTarget(Object)`, and the AOP framework can cache the return value of `getTarget()`.

      返回:
        `true` if the target is immutable
      另请参阅:
        `getTarget()`

    - #### getTarget

          @Nullable
          Object getTarget()
                               throws Exception

      Return a target instance. Invoked immediately before the AOP framework calls the "target" of an AOP method invocation.
      返回:
        the target object which contains the joinpoint, or `null` if there is no actual target instance
      抛出:
        `Exception` - if the target object can't be resolved

    - #### releaseTarget

          void releaseTarget(Object target)
                      throws Exception

      Release the given target object obtained from the `getTarget()` method, if any.
      参数:
        `target` - object obtained from a call to `getTarget()`
      抛出:
        `Exception` - if the object can't be released