org.springframework.aop.target.dynamic

## 类 AbstractRefreshableTargetSource

- java.lang.Object
- - org.springframework.aop.target.dynamic.AbstractRefreshableTargetSource

- 所有已实现的接口:
    Refreshable, TargetClassAware, TargetSource
  直接已知子类:
    BeanFactoryRefreshableTargetSource

      public abstract class AbstractRefreshableTargetSource
      extends Object
      implements TargetSource, Refreshable

  Abstract `TargetSource` implementation that wraps a refreshable target object. Subclasses can determine whether a refresh is required, and need to provide fresh target objects.

  Implements the `Refreshable` interface in order to allow for explicit control over the refresh status.

  从以下版本开始:
    2.0
  作者:
    Rod Johnson, Rob Harrop, Juergen Hoeller
  另请参阅:
    `requiresRefresh()`, `freshTarget()`

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `protected Log` | `logger` Logger available to subclasses
    `protected Object` | `targetObject`

  - ### 构造器概要

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

  - ### 方法概要

    所有方法 实例方法 抽象方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected abstract Object` | `freshTarget()` Obtain a fresh target object.
    `long` | `getLastRefreshTime()` Return the last time an actual refresh happened (as timestamp).
    `long` | `getRefreshCount()` Return the number of actual refreshes since startup.
    `Object` | `getTarget()` Return a target instance.
    `Class<?>` | `getTargetClass()` Return the type of targets returned by this `TargetSource`.
    `boolean` | `isStatic()` Not static.
    `void` | `refresh()` Refresh the underlying target object.
    `void` | `releaseTarget(Object object)` No need to release target.
    `protected boolean` | `requiresRefresh()` Determine whether a refresh is required.
    `void` | `setRefreshCheckDelay(long refreshCheckDelay)` Set the delay between refresh checks, in milliseconds.

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

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

- - ### 字段详细资料

    - #### logger

          protected final Log logger

      Logger available to subclasses

    - #### targetObject

          @Nullable
          protected Object targetObject

  - ### 构造器详细资料

    - #### AbstractRefreshableTargetSource

          public AbstractRefreshableTargetSource()

  - ### 方法详细资料

    - #### setRefreshCheckDelay

          public void setRefreshCheckDelay(long refreshCheckDelay)

      Set the delay between refresh checks, in milliseconds. Default is -1, indicating no refresh checks at all.

      Note that an actual refresh will only happen when `requiresRefresh()` returns `true`.

    - #### getTargetClass

          public Class<?> getTargetClass()

      从接口复制的说明: `TargetSource`
      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`
      指定者:
        `getTargetClass` 在接口中 `TargetSource`
      返回:
        the type of targets returned by this `TargetSource`

    - #### isStatic

          public boolean isStatic()

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

    - #### getTarget

          @Nullable
          public final 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 object)

      No need to release target.
      指定者:
        `releaseTarget` 在接口中 `TargetSource`
      参数:
        `object` - object obtained from a call to `TargetSource.getTarget()`

    - #### refresh

          public final void refresh()

      从接口复制的说明: `Refreshable`
      Refresh the underlying target object.
      指定者:
        `refresh` 在接口中 `Refreshable`

    - #### getRefreshCount

          public long getRefreshCount()

      从接口复制的说明: `Refreshable`
      Return the number of actual refreshes since startup.
      指定者:
        `getRefreshCount` 在接口中 `Refreshable`

    - #### getLastRefreshTime

          public long getLastRefreshTime()

      从接口复制的说明: `Refreshable`
      Return the last time an actual refresh happened (as timestamp).
      指定者:
        `getLastRefreshTime` 在接口中 `Refreshable`

    - #### requiresRefresh

          protected boolean requiresRefresh()

      Determine whether a refresh is required. Invoked for each refresh check, after the refresh check delay has elapsed.

      The default implementation always returns `true`, triggering a refresh every time the delay has elapsed. To be overridden by subclasses with an appropriate check of the underlying target resource.

      返回:
        whether a refresh is required

    - #### freshTarget

          protected abstract Object freshTarget()

      Obtain a fresh target object.

      Only invoked if a refresh check has found that a refresh is required (that is, `requiresRefresh()` has returned `true`).

      返回:
        the fresh target object