Package org.springframework.aop
Interface TargetSource
- All Superinterfaces:
- TargetClassAware
- All Known Implementing Classes:
- AbstractBeanFactoryBasedTargetSource,- AbstractLazyCreationTargetSource,- AbstractPoolingTargetSource,- AbstractPrototypeBasedTargetSource,- AbstractRefreshableTargetSource,- BeanFactoryRefreshableTargetSource,- CommonsPool2TargetSource,- EmptyTargetSource,- HotSwappableTargetSource,- JndiObjectTargetSource,- LazyInitTargetSource,- PrototypeTargetSource,- RefreshableScriptTargetSource,- SimpleBeanTargetSource,- SingletonTargetSource,- ThreadLocalTargetSource
A 
TargetSource is used to obtain the current "target" of
 an AOP invocation, which will be invoked via reflection if no around
 advice chooses to end the interceptor chain itself.
 If a TargetSource is "static", it will always return
 the same target, allowing optimizations in the AOP framework. Dynamic
 target sources can support pooling, hot swapping, etc.
 
Application developers don't usually need to work with
 TargetSources directly: this is an AOP framework interface.
- Author:
- Rod Johnson, Juergen Hoeller
- 
Method SummaryModifier and TypeMethodDescriptionReturn a target instance.Class<?>Return the type of targets returned by thisTargetSource.booleanisStatic()Will all calls togetTarget()return the same object?voidreleaseTarget(Object target) Release the given target object obtained from thegetTarget()method, if any.
- 
Method Details- 
getTargetClassReturn the type of targets returned by thisTargetSource.Can return null, although certain usages of aTargetSourcemight just work with a predetermined target class.- Specified by:
- getTargetClassin interface- TargetClassAware
- Returns:
- the type of targets returned by this TargetSource
 
- 
isStaticboolean isStatic()Will all calls togetTarget()return the same object?In that case, there will be no need to invoke releaseTarget(Object), and the AOP framework can cache the return value ofgetTarget().- Returns:
- trueif the target is immutable
- See Also:
 
- 
getTargetReturn a target instance. Invoked immediately before the AOP framework calls the "target" of an AOP method invocation.- Returns:
- the target object which contains the joinpoint,
 or nullif there is no actual target instance
- Throws:
- Exception- if the target object can't be resolved
 
- 
releaseTargetRelease the given target object obtained from thegetTarget()method, if any.- Parameters:
- target- object obtained from a call to- getTarget()
- Throws:
- Exception- if the object can't be released
 
 
-