public class EmptyTargetSource extends java.lang.Object implements TargetSource, java.io.Serializable
TargetSource when there is no target
(or just the target class known), and behavior is supplied
by interfaces and advisors only.| Modifier and Type | Field and Description |
|---|---|
static EmptyTargetSource |
INSTANCE
The canonical (Singleton) instance of this
EmptyTargetSource. |
private boolean |
isStatic |
private static long |
serialVersionUID
use serialVersionUID from Spring 1.2 for interoperability
|
private java.lang.Class<?> |
targetClass |
| Modifier | Constructor and Description |
|---|---|
private |
EmptyTargetSource(java.lang.Class<?> targetClass,
boolean isStatic)
Create a new instance of the
EmptyTargetSource class. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object other) |
static EmptyTargetSource |
forClass(java.lang.Class<?> targetClass)
Return an EmptyTargetSource for the given target Class.
|
static EmptyTargetSource |
forClass(java.lang.Class<?> targetClass,
boolean isStatic)
Return an EmptyTargetSource for the given target Class.
|
java.lang.Object |
getTarget()
Always returns
null. |
java.lang.Class<?> |
getTargetClass()
Always returns the specified target Class, or
null if none. |
int |
hashCode() |
boolean |
isStatic()
Always returns
true. |
private java.lang.Object |
readResolve()
Returns the canonical instance on deserialization in case
of no target class, thus protecting the Singleton pattern.
|
void |
releaseTarget(java.lang.Object target)
Nothing to release.
|
java.lang.String |
toString() |
private static final long serialVersionUID
public static final EmptyTargetSource INSTANCE
EmptyTargetSource.private final java.lang.Class<?> targetClass
private final boolean isStatic
private EmptyTargetSource(java.lang.Class<?> targetClass,
boolean isStatic)
EmptyTargetSource class.
This constructor is private to enforce the
Singleton pattern / factory method pattern.
targetClass - the target class to expose (may be null)isStatic - whether the TargetSource is marked as staticpublic static EmptyTargetSource forClass(java.lang.Class<?> targetClass)
targetClass - the target Class (may be null)getTargetClass()public static EmptyTargetSource forClass(java.lang.Class<?> targetClass, boolean isStatic)
targetClass - the target Class (may be null)isStatic - whether the TargetSource should be marked as staticgetTargetClass()public java.lang.Class<?> getTargetClass()
null if none.getTargetClass in interface TargetClassAwaregetTargetClass in interface TargetSourceTargetSourcepublic boolean isStatic()
true.isStatic in interface TargetSourcetrue if the target is immutableTargetSource.getTarget()public java.lang.Object getTarget()
null.getTarget in interface TargetSourcepublic void releaseTarget(java.lang.Object target)
releaseTarget in interface TargetSourcetarget - object obtained from a call to TargetSource.getTarget()private java.lang.Object readResolve()
public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object