类 SingletonTargetSource
- java.lang.Object
- org.springframework.aop.target.SingletonTargetSource
- 所有已实现的接口:
Serializable,TargetClassAware,TargetSource
public class SingletonTargetSource extends Object implements TargetSource, Serializable
Implementation of theTargetSourceinterface that holds a given object. This is the default implementation of the TargetSource interface, as used by the Spring AOP framework. There is usually no need to create objects of this class in application code.This class is serializable. However, the actual serializability of a SingletonTargetSource will depend on whether the target is serializable.
- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
AdvisedSupport.setTarget(Object), 序列化表格
构造器概要
构造器 构造器 说明 SingletonTargetSource(Object target)Create a new SingletonTargetSource for the given target.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanequals(Object other)Two invoker interceptors are equal if they have the same target or if the targets or the targets are equal.ObjectgetTarget()Return a target instance.Class<?>getTargetClass()Return the type of targets returned by thisTargetSource.inthashCode()SingletonTargetSource uses the hash code of the target object.booleanisStatic()Will all calls toTargetSource.getTarget()return the same object?voidreleaseTarget(Object target)Release the given target object obtained from theTargetSource.getTarget()method, if any.StringtoString()
构造器详细资料
SingletonTargetSource
public SingletonTargetSource(Object target)
Create a new SingletonTargetSource for the given target.- 参数:
target- the target object
方法详细资料
getTargetClass
public Class<?> getTargetClass()
从接口复制的说明:TargetSourceReturn the type of targets returned by thisTargetSource.Can return
null, although certain usages of aTargetSourcemight just work with a predetermined target class.- 指定者:
getTargetClass在接口中TargetClassAware- 指定者:
getTargetClass在接口中TargetSource- 返回:
- the type of targets returned by this
TargetSource
getTarget
public Object getTarget()
从接口复制的说明:TargetSourceReturn 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
nullif there is no actual target instance
releaseTarget
public void releaseTarget(Object target)
从接口复制的说明:TargetSourceRelease the given target object obtained from theTargetSource.getTarget()method, if any.- 指定者:
releaseTarget在接口中TargetSource- 参数:
target- object obtained from a call toTargetSource.getTarget()
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().- 指定者:
isStatic在接口中TargetSource- 返回:
trueif the target is immutable- 另请参阅:
TargetSource.getTarget()
equals
public boolean equals(Object other)
Two invoker interceptors are equal if they have the same target or if the targets or the targets are equal.
hashCode
public int hashCode()
SingletonTargetSource uses the hash code of the target object.