Package net.sf.jguiraffe.di
Class BeanCreationEvent
- java.lang.Object
-
- java.util.EventObject
-
- net.sf.jguiraffe.di.BeanCreationEvent
-
- All Implemented Interfaces:
Serializable
public class BeanCreationEvent extends EventObject
An event class for reporting the creation of a bean by the dependency injection framework.
Objects of this event class are received by
BeanCreationListenerimplementations, which can be registered at aBeanContextobject. Whenever theBeanContextis queried for a bean, and this bean has to be newly created (e.g. because of the first access of a singleton bean or because it is a factory bean), an event of this type is triggered.- Version:
- $Id: BeanCreationEvent.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor Description BeanCreationEvent(BeanContext source, BeanProvider provider, DependencyProvider depProvider, Object newBean)Creates a new instance ofBeanCreationEventand initializes it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetBean()Returns the newly created bean.BeanContextgetBeanContext()Returns theBeanContextthat caused this event.BeanProvidergetBeanProvider()Returns theBeanProviderthat created the new bean.DependencyProvidergetDependencyProvider()Returns theDependencyProviderinvolved in the bean creation process.-
Methods inherited from class java.util.EventObject
getSource, toString
-
-
-
-
Constructor Detail
-
BeanCreationEvent
public BeanCreationEvent(BeanContext source, BeanProvider provider, DependencyProvider depProvider, Object newBean)
Creates a new instance ofBeanCreationEventand initializes it.- Parameters:
source- theBeanContextthat caused this eventprovider- theBeanProviderthat created the beandepProvider- theDependencyProviderused for creating the beannewBean- the newly created bean
-
-
Method Detail
-
getBeanContext
public BeanContext getBeanContext()
Returns theBeanContextthat caused this event.- Returns:
- the source
BeanContext
-
getBeanProvider
public BeanProvider getBeanProvider()
Returns theBeanProviderthat created the new bean.- Returns:
- the responsible
BeanProvider
-
getDependencyProvider
public DependencyProvider getDependencyProvider()
Returns theDependencyProviderinvolved in the bean creation process. This is the object that was passed to theBeanProviderwhen it created the new bean.- Returns:
- the
DependencyProviderinvolved when creating the bean
-
getBean
public Object getBean()
Returns the newly created bean.- Returns:
- the bean
-
-