public class SingletonTargetSource extends Object implements TargetSource, Serializable
TargetSource interface
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.
AdvisedSupport.setTarget(Object),
序列化表格| 构造器和说明 |
|---|
SingletonTargetSource(Object target)
Create a new SingletonTargetSource for the given target.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(Object other)
Two invoker interceptors are equal if they have the same target or if the
targets or the targets are equal.
|
Object |
getTarget()
Return a target instance.
|
Class<?> |
getTargetClass()
Return the type of targets returned by this
TargetSource. |
int |
hashCode()
SingletonTargetSource uses the hash code of the target object.
|
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. |
String |
toString() |
public SingletonTargetSource(Object target)
target - the target objectpublic Class<?> getTargetClass()
TargetSourceTargetSource.
Can return null, although certain usages of a TargetSource
might just work with a predetermined target class.
getTargetClass 在接口中 TargetClassAwaregetTargetClass 在接口中 TargetSourceTargetSourcepublic Object getTarget()
TargetSourcegetTarget 在接口中 TargetSourcenull if there is no actual target instancepublic void releaseTarget(Object target)
TargetSourceTargetSource.getTarget() method, if any.releaseTarget 在接口中 TargetSourcetarget - object obtained from a call to TargetSource.getTarget()public boolean isStatic()
TargetSourceTargetSource.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 在接口中 TargetSourcetrue if the target is immutableTargetSource.getTarget()public boolean equals(Object other)
public int hashCode()