org.springframework.aop.target

## 类 HotSwappableTargetSource

- java.lang.Object
- - org.springframework.aop.target.HotSwappableTargetSource

- 所有已实现的接口:
    Serializable, TargetClassAware, TargetSource

      public class HotSwappableTargetSource
      extends Object
      implements TargetSource, Serializable

  `TargetSource` implementation that caches a local target object, but allows the target to be swapped while the application is running.

  If configuring an object of this class in a Spring IoC container, use constructor injection.

  This TargetSource is serializable if the target is at the time of serialization.

  作者:
    Rod Johnson, Juergen Hoeller
  另请参阅:
    序列化表格

- - ### 构造器概要

    构造器
    构造器和说明
    `HotSwappableTargetSource(Object initialTarget)` Create a new HotSwappableTargetSource with the given initial target object.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `boolean` | `equals(Object other)` Two HotSwappableTargetSources are equal if the current target objects are equal.
    `Object` | `getTarget()` Return a target instance.
    `Class<?>` | `getTargetClass()` Return the type of the current target object.
    `int` | `hashCode()`
    `boolean` | `isStatic()` Will all calls to `TargetSource.getTarget()` return the same object?
    `void` | `releaseTarget(Object target)` Release the given target object obtained from the `TargetSource.getTarget()` method, if any.
    `Object` | `swap(Object newTarget)` Swap the target, returning the old target object.
    `String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### 构造器详细资料

    - #### HotSwappableTargetSource

          public HotSwappableTargetSource(Object initialTarget)

      Create a new HotSwappableTargetSource with the given initial target object.
      参数:
        `initialTarget` - the initial target object

  - ### 方法详细资料

    - #### getTargetClass

          public Class<?> getTargetClass()

      Return the type of the current target object.

      The returned type should usually be constant across all target objects.

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

    - #### isStatic

          public final boolean isStatic()

      从接口复制的说明: `TargetSource`
      Will all calls to `TargetSource.getTarget()` return the same object?

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

      指定者:
        `isStatic` 在接口中 `TargetSource`
      返回:
        `true` if the target is immutable
      另请参阅:
        `TargetSource.getTarget()`

    - #### getTarget

          public Object getTarget()

      从接口复制的说明: `TargetSource`
      Return a target instance. Invoked immediately before the AOP framework calls the "target" of an AOP method invocation.
      指定者:
        `getTarget` 在接口中 `TargetSource`
      返回:
        the target object which contains the joinpoint, or `null` if there is no actual target instance

    - #### releaseTarget

          public void releaseTarget(Object target)

      从接口复制的说明: `TargetSource`
      Release the given target object obtained from the `TargetSource.getTarget()` method, if any.
      指定者:
        `releaseTarget` 在接口中 `TargetSource`
      参数:
        `target` - object obtained from a call to `TargetSource.getTarget()`

    - #### swap

          public Object swap(Object newTarget)
                      throws IllegalArgumentException

      Swap the target, returning the old target object.
      参数:
        `newTarget` - the new target object
      返回:
        the old target object
      抛出:
        `IllegalArgumentException` - if the new target is invalid

    - #### equals

          public boolean equals(Object other)

      Two HotSwappableTargetSources are equal if the current target objects are equal.
      覆盖:
        `equals` 在类中 `Object`

    - #### hashCode

          public int hashCode()

      覆盖:
        `hashCode` 在类中 `Object`

    - #### toString

          public String toString()

      覆盖:
        `toString` 在类中 `Object`