|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.aop.target.HotSwappableTargetSource
public class HotSwappableTargetSource
Implementation of TargetSource interface 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.
Constructor Summary | |
---|---|
HotSwappableTargetSource(Object initialTarget)
Create a new HotSwappableTargetSource with the given initial target object. |
Method Summary | |
---|---|
boolean |
equals(Object other)
Two HotSwappableTargetSources are equal if the targets are equal. |
Object |
getTarget()
Synchronization around something that takes so little time is fine. |
Class |
getTargetClass()
Return the type of targets returned by this TargetSource. |
int |
hashCode()
|
boolean |
isStatic()
Will all calls to getTarget() return the same object? |
void |
releaseTarget(Object o)
Release the given target object obtained from the getTarget() method. |
Object |
swap(Object newTarget)
Swap the target, returning the old target. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HotSwappableTargetSource(Object initialTarget)
initialTarget
- the initial target objectMethod Detail |
---|
public Class getTargetClass()
TargetSource
null
, although certain usages of a TargetSource
might just work with a predetermined target class.
getTargetClass
in interface TargetSource
public final boolean isStatic()
TargetSource
getTarget()
return the same object?
In that case, there will be no need to invoke releaseTarget
,
and the AOP framework can cache the return value of getTarget()
.
isStatic
in interface TargetSource
TargetSource.getTarget()
public Object getTarget()
getTarget
in interface TargetSource
public void releaseTarget(Object o)
TargetSource
getTarget()
method.
releaseTarget
in interface TargetSource
o
- object obtained from a call to getTarget()
TargetSource.getTarget()
public Object swap(Object newTarget) throws IllegalArgumentException
newTarget
- new target
IllegalArgumentException
- if the new target is invalidpublic String toString()
toString
in class Object
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |