The Spring Framework

org.springframework.aop.config
Class BeanFactoryAspectInstanceFactory

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

public class BeanFactoryAspectInstanceFactory
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

Constructor Summary
BeanFactoryAspectInstanceFactory()
           
 
Method Summary
 Object getAspectInstance()
          Look up the aspect bean from the BeanFactory and returns it.
 int getInstantiationCount()
          Return the number of instantiations from this factory.
 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

BeanFactoryAspectInstanceFactory

public BeanFactoryAspectInstanceFactory()
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 (may not be 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
See Also:
setAspectBeanName(java.lang.String)

getInstantiationCount

public int getInstantiationCount()
Description copied from interface: AspectInstanceFactory
Return the number of instantiations from this factory.

Specified by:
getInstantiationCount in interface AspectInstanceFactory
Returns:
the number of aspect instances created

The Spring Framework

Copyright © 2002-2006 The Spring Framework.