程序包 infra.aop.target
类 AbstractLazyCreationTargetSource
java.lang.Object
infra.aop.target.AbstractLazyCreationTargetSource
- 所有已实现的接口:
TargetClassAware,TargetSource
TargetSource implementation that will
lazily create a user-managed object.
Creation of the lazy target object is controlled by the user by implementing
the createObject() method. This TargetSource will invoke
this method the first time the proxy is accessed.
Useful when you need to pass a reference to some dependency to an object but you don't actually want the dependency to be created until it is first used. A typical scenario for this is a connection to a remote resource.
- 从以下版本开始:
- 3.0
- 作者:
- Rob Harrop, Juergen Hoeller, TODAY 2021/2/1 21:15
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明private ObjectThe lazily initialized target object.protected final infra.logging.LoggerLogger available to subclasses. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected abstract ObjectSubclasses should implement this method to return the lazy initialized object.Returns the lazy-initialized target object, creating it on-the-fly if it doesn't exist already.Class<?>This default implementation returnsnullif the target isnull(it is hasn't yet been initialized), or the target class if the target has already been initialized.booleanReturn whether the lazy target object of this TargetSource has already been fetched.booleanisStatic()Will all calls toTargetSource.getTarget()return the same object?从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 infra.aop.TargetSource
releaseTarget
-
字段详细资料
-
logger
protected final infra.logging.Logger loggerLogger available to subclasses. -
lazyTarget
The lazily initialized target object.
-
-
构造器详细资料
-
AbstractLazyCreationTargetSource
public AbstractLazyCreationTargetSource()
-
-
方法详细资料
-
isInitialized
public boolean isInitialized()Return whether the lazy target object of this TargetSource has already been fetched. -
getTargetClass
This default implementation returnsnullif the target isnull(it is hasn't yet been initialized), or the target class if the target has already been initialized.Subclasses may wish to override this method in order to provide a meaningful value when the target is still
null.- 指定者:
getTargetClass在接口中TargetClassAware- 指定者:
getTargetClass在接口中TargetSource- 返回:
- the type of targets returned by this
TargetSource - 另请参阅:
-
isStatic
public boolean isStatic()从接口复制的说明:TargetSourceWill all calls toTargetSource.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 ofTargetSource.getTarget().The default implementation returns
false.- 指定者:
isStatic在接口中TargetSource- 返回:
trueif the target is immutable- 另请参阅:
-
getTarget
Returns the lazy-initialized target object, creating it on-the-fly if it doesn't exist already.- 指定者:
getTarget在接口中TargetSource- 返回:
- the target object which contains the join-point,
or
nullif there is no actual target instance - 抛出:
Exception- if the target object can't be resolved- 另请参阅:
-
createObject
Subclasses should implement this method to return the lazy initialized object. Called the first time the proxy is invoked.- 返回:
- the created object
- 抛出:
Exception
-