Package org.springframework.aop.target
Class EmptyTargetSource
- java.lang.Object
- org.springframework.aop.target.EmptyTargetSource
- All Implemented Interfaces:
Serializable
,TargetClassAware
,TargetSource
public final class EmptyTargetSource extends Object implements TargetSource, Serializable
CanonicalTargetSource
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
Fields Modifier and Type Field Description static EmptyTargetSource
INSTANCE
The canonical (Singleton) instance of thisEmptyTargetSource
.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
static EmptyTargetSource
forClass(Class<?> targetClass)
Return an EmptyTargetSource for the given target Class.static EmptyTargetSource
forClass(Class<?> targetClass, boolean isStatic)
Return an EmptyTargetSource for the given target Class.Object
getTarget()
Always returnsnull
.Class<?>
getTargetClass()
Always returns the specified target Class, ornull
if none.int
hashCode()
boolean
isStatic()
Always returnstrue
.void
releaseTarget(Object target)
Nothing to release.String
toString()
Field Detail
INSTANCE
public static final EmptyTargetSource INSTANCE
The canonical (Singleton) instance of thisEmptyTargetSource
.
Method Detail
forClass
public static EmptyTargetSource forClass(@Nullable Class<?> targetClass)
Return an EmptyTargetSource for the given target Class.- Parameters:
targetClass
- the target Class (may benull
)- See Also:
getTargetClass()
forClass
public static EmptyTargetSource forClass(@Nullable Class<?> targetClass, boolean isStatic)
Return an EmptyTargetSource for the given target Class.- Parameters:
targetClass
- the target Class (may benull
)isStatic
- whether the TargetSource should be marked as static- See Also:
getTargetClass()
getTargetClass
@Nullable public Class<?> getTargetClass()
Always returns the specified target Class, ornull
if none.- Specified by:
getTargetClass
in interfaceTargetClassAware
- Specified by:
getTargetClass
in interfaceTargetSource
- Returns:
- the type of targets returned by this
TargetSource
isStatic
public boolean isStatic()
Always returnstrue
.- Specified by:
isStatic
in interfaceTargetSource
- Returns:
true
if the target is immutable- See Also:
TargetSource.getTarget()
getTarget
@Nullable public Object getTarget()
Always returnsnull
.- Specified by:
getTarget
in interfaceTargetSource
- Returns:
- the target object which contains the joinpoint, or
null
if there is no actual target instance
releaseTarget
public void releaseTarget(Object target)
Nothing to release.- Specified by:
releaseTarget
in interfaceTargetSource
- Parameters:
target
- object obtained from a call toTargetSource.getTarget()