Package org.springframework.aop.aspectj
Class SingletonAspectInstanceFactory
- java.lang.Object
- org.springframework.aop.aspectj.SingletonAspectInstanceFactory
- All Implemented Interfaces:
Serializable,AspectInstanceFactory,Ordered
- Direct Known Subclasses:
SingletonMetadataAwareAspectInstanceFactory
public class SingletonAspectInstanceFactory extends Object implements AspectInstanceFactory, Serializable
Implementation ofAspectInstanceFactorythat is backed by a specified singleton object, returning the same instance for everygetAspectInstance()call.- Since:
- 2.0
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
SimpleAspectInstanceFactory, Serialized Form
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor Summary
Constructors Constructor Description SingletonAspectInstanceFactory(Object aspectInstance)Create a new SingletonAspectInstanceFactory for the given aspect instance.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassLoadergetAspectClassLoader()Expose the aspect class loader that this factory uses.ObjectgetAspectInstance()Create an instance of this factory's aspect.intgetOrder()Determine the order for this factory's aspect instance, either an instance-specific order expressed through implementing theOrderedinterface, or a fallback order.protected intgetOrderForAspectClass(Class<?> aspectClass)Determine a fallback order for the case that the aspect instance does not express an instance-specific order through implementing theOrderedinterface.
Constructor Detail
SingletonAspectInstanceFactory
public SingletonAspectInstanceFactory(Object aspectInstance)
Create a new SingletonAspectInstanceFactory for the given aspect instance.- Parameters:
aspectInstance- the singleton aspect instance
Method Detail
getAspectInstance
public final Object getAspectInstance()
Description copied from interface:AspectInstanceFactoryCreate an instance of this factory's aspect.- Specified by:
getAspectInstancein interfaceAspectInstanceFactory- Returns:
- the aspect instance (never
null)
getAspectClassLoader
public ClassLoader getAspectClassLoader()
Description copied from interface:AspectInstanceFactoryExpose the aspect class loader that this factory uses.- Specified by:
getAspectClassLoaderin interfaceAspectInstanceFactory- Returns:
- the aspect class loader (never
null)
getOrder
public int getOrder()
Determine the order for this factory's aspect instance, either an instance-specific order expressed through implementing theOrderedinterface, or a fallback order.- Specified by:
getOrderin interfaceOrdered- Returns:
- the order value
- See Also:
Ordered,getOrderForAspectClass(java.lang.Class<?>)
getOrderForAspectClass
protected int getOrderForAspectClass(Class<?> aspectClass)
Determine a fallback order for the case that the aspect instance does not express an instance-specific order through implementing theOrderedinterface.The default implementation simply returns
Ordered.LOWEST_PRECEDENCE.- Parameters:
aspectClass- the aspect class