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
BeanCreationListener
implementations, which can be registered at aBeanContext
object. Whenever theBeanContext
is 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 ofBeanCreationEvent
and initializes it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getBean()
Returns the newly created bean.BeanContext
getBeanContext()
Returns theBeanContext
that caused this event.BeanProvider
getBeanProvider()
Returns theBeanProvider
that created the new bean.DependencyProvider
getDependencyProvider()
Returns theDependencyProvider
involved 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 ofBeanCreationEvent
and initializes it.- Parameters:
source
- theBeanContext
that caused this eventprovider
- theBeanProvider
that created the beandepProvider
- theDependencyProvider
used for creating the beannewBean
- the newly created bean
-
-
Method Detail
-
getBeanContext
public BeanContext getBeanContext()
Returns theBeanContext
that caused this event.- Returns:
- the source
BeanContext
-
getBeanProvider
public BeanProvider getBeanProvider()
Returns theBeanProvider
that created the new bean.- Returns:
- the responsible
BeanProvider
-
getDependencyProvider
public DependencyProvider getDependencyProvider()
Returns theDependencyProvider
involved in the bean creation process. This is the object that was passed to theBeanProvider
when it created the new bean.- Returns:
- the
DependencyProvider
involved when creating the bean
-
getBean
public Object getBean()
Returns the newly created bean.- Returns:
- the bean
-
-