org.springframework.aop.target
Class EmptyTargetSource

java.lang.Object
  extended by org.springframework.aop.target.EmptyTargetSource
All Implemented Interfaces:
java.io.Serializable, TargetClassAware, TargetSource

public class EmptyTargetSource
extends java.lang.Object
implements TargetSource, java.io.Serializable

Canonical TargetSource when there is no target (or just the target class known), and behavior is supplied by interfaces and advisors only.

Author:
Rod Johnson, Juergen Hoeller
See Also:
Serialized Form

Field Summary
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
           
 
Constructor Summary
private EmptyTargetSource(java.lang.Class targetClass, boolean isStatic)
          Create a new instance of the EmptyTargetSource class.
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
use serialVersionUID from Spring 1.2 for interoperability

See Also:
Constant Field Values

INSTANCE

public static final EmptyTargetSource INSTANCE
The canonical (Singleton) instance of this EmptyTargetSource.


targetClass

private final java.lang.Class targetClass

isStatic

private final boolean isStatic
Constructor Detail

EmptyTargetSource

private EmptyTargetSource(java.lang.Class targetClass,
                          boolean isStatic)
Create a new instance of the EmptyTargetSource class.

This constructor is private to enforce the Singleton pattern / factory method pattern.

Parameters:
targetClass - the target class to expose (may be null)
isStatic - whether the TargetSource is marked as static
Method Detail

forClass

public static EmptyTargetSource forClass(java.lang.Class targetClass)
Return an EmptyTargetSource for the given target Class.

Parameters:
targetClass - the target Class (may be null)
See Also:
getTargetClass()

forClass

public static EmptyTargetSource forClass(java.lang.Class targetClass,
                                         boolean isStatic)
Return an EmptyTargetSource for the given target Class.

Parameters:
targetClass - the target Class (may be null)
isStatic - whether the TargetSource should be marked as static
See Also:
getTargetClass()

getTargetClass

public java.lang.Class<?> getTargetClass()
Always returns the specified target Class, or null if none.

Specified by:
getTargetClass in interface TargetClassAware
Specified by:
getTargetClass in interface TargetSource
Returns:
the type of targets returned by this TargetSource

isStatic

public boolean isStatic()
Always returns true.

Specified by:
isStatic in interface TargetSource
Returns:
true if the target is immutable
See Also:
TargetSource.getTarget()

getTarget

public java.lang.Object getTarget()
Always returns null.

Specified by:
getTarget in interface TargetSource
Returns:
the target object, which contains the joinpoint

releaseTarget

public void releaseTarget(java.lang.Object target)
Nothing to release.

Specified by:
releaseTarget in interface TargetSource
Parameters:
target - object obtained from a call to TargetSource.getTarget()

readResolve

private java.lang.Object readResolve()
Returns the canonical instance on deserialization in case of no target class, thus protecting the Singleton pattern.


equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object