Package org.springframework.aop.aspectj
Class SimpleAspectInstanceFactory
- java.lang.Object
- org.springframework.aop.aspectj.SimpleAspectInstanceFactory
- All Implemented Interfaces:
AspectInstanceFactory
,Ordered
- Direct Known Subclasses:
SimpleMetadataAwareAspectInstanceFactory
public class SimpleAspectInstanceFactory extends Object implements AspectInstanceFactory
Implementation ofAspectInstanceFactory
that creates a new instance of the specified aspect class for everygetAspectInstance()
call.- Since:
- 2.0.4
- Author:
- Juergen Hoeller
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor Summary
Constructors Constructor Description SimpleAspectInstanceFactory(Class<?> aspectClass)
Create a new SimpleAspectInstanceFactory for the given aspect class.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>
getAspectClass()
Return the specified aspect class (nevernull
).ClassLoader
getAspectClassLoader()
Expose the aspect class loader that this factory uses.Object
getAspectInstance()
Create an instance of this factory's aspect.int
getOrder()
Determine the order for this factory's aspect instance, either an instance-specific order expressed through implementing theOrdered
interface, or a fallback order.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 theOrdered
interface.
Constructor Detail
SimpleAspectInstanceFactory
public SimpleAspectInstanceFactory(Class<?> aspectClass)
Create a new SimpleAspectInstanceFactory for the given aspect class.- Parameters:
aspectClass
- the aspect class
Method Detail
getAspectClass
public final Class<?> getAspectClass()
Return the specified aspect class (nevernull
).
getAspectInstance
public final Object getAspectInstance()
Description copied from interface:AspectInstanceFactory
Create an instance of this factory's aspect.- Specified by:
getAspectInstance
in interfaceAspectInstanceFactory
- Returns:
- the aspect instance (never
null
)
getAspectClassLoader
public ClassLoader getAspectClassLoader()
Description copied from interface:AspectInstanceFactory
Expose the aspect class loader that this factory uses.- Specified by:
getAspectClassLoader
in 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 theOrdered
interface, or a fallback order.- Specified by:
getOrder
in 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 theOrdered
interface.The default implementation simply returns
Ordered.LOWEST_PRECEDENCE
.- Parameters:
aspectClass
- the aspect class