org.springframework.aop.config
Class SimpleBeanFactoryAwareAspectInstanceFactory

java.lang.Object
  extended by org.springframework.aop.config.SimpleBeanFactoryAwareAspectInstanceFactory
All Implemented Interfaces:
AspectInstanceFactory, BeanFactoryAware, Ordered

public class SimpleBeanFactoryAwareAspectInstanceFactory
extends Object
implements AspectInstanceFactory, BeanFactoryAware

Implementation of AspectInstanceFactory that locates the aspect from the BeanFactory using a configured bean name.

Since:
2.0
Author:
Rob Harrop, Juergen Hoeller

Field Summary
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
SimpleBeanFactoryAwareAspectInstanceFactory()
           
 
Method Summary
 ClassLoader getAspectClassLoader()
          Expose the aspect class loader that this factory uses.
 Object getAspectInstance()
          Look up the aspect bean from the BeanFactory and returns it.
 int getOrder()
          Return the order value of this object, with a higher value meaning greater in terms of sorting.
 void setAspectBeanName(String aspectBeanName)
          Set the name of the aspect bean.
 void setBeanFactory(BeanFactory beanFactory)
          Callback that supplies the owning factory to a bean instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBeanFactoryAwareAspectInstanceFactory

public SimpleBeanFactoryAwareAspectInstanceFactory()
Method Detail

setAspectBeanName

public void setAspectBeanName(String aspectBeanName)
Set the name of the aspect bean. This is the bean that is returned when calling getAspectInstance().


setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
Description copied from interface: BeanFactoryAware
Callback that supplies the owning factory to a bean instance.

Invoked after the population of normal bean properties but before an initialization callback such as InitializingBean.afterPropertiesSet() or a custom init-method.

Specified by:
setBeanFactory in interface BeanFactoryAware
Parameters:
beanFactory - owning BeanFactory (never null). The bean can immediately call methods on the factory.
See Also:
BeanInitializationException

getAspectInstance

public Object getAspectInstance()
Look up the aspect bean from the BeanFactory and returns it.

Specified by:
getAspectInstance in interface AspectInstanceFactory
Returns:
the aspect instance (never null)
See Also:
setAspectBeanName(java.lang.String)

getAspectClassLoader

public ClassLoader getAspectClassLoader()
Description copied from interface: AspectInstanceFactory
Expose the aspect class loader that this factory uses.

Specified by:
getAspectClassLoader in interface AspectInstanceFactory
Returns:
the aspect class loader (never null)

getOrder

public int getOrder()
Description copied from interface: Ordered
Return the order value of this object, with a higher value meaning greater in terms of sorting.

Normally starting with 0 or 1, with Ordered.LOWEST_PRECEDENCE indicating greatest. Same order values will result in arbitrary positions for the affected objects.

Higher value can be interpreted as lower priority, consequently the first object has highest priority (somewhat analogous to Servlet "load-on-startup" values).

Note that order values below 0 are reserved for framework purposes. Application-specified values should always be 0 or greater, with only framework components (internal or third-party) supposed to use lower values.

Specified by:
getOrder in interface Ordered
Returns:
the order value
See Also:
Ordered.LOWEST_PRECEDENCE


Copyright © 2002-2008 The Spring Framework.