net.sf.jguiraffe.di
Class BeanCreationEvent

java.lang.Object
  extended by java.util.EventObject
      extended by net.sf.jguiraffe.di.BeanCreationEvent
All Implemented Interfaces:
java.io.Serializable

public class BeanCreationEvent
extends java.util.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 a BeanContext object. Whenever the BeanContext 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 156 2009-03-03 21:04:47Z oheger $
Author:
Oliver Heger
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
BeanCreationEvent(BeanContext source, BeanProvider provider, DependencyProvider depProvider, java.lang.Object newBean)
          Creates a new instance of BeanCreationEvent and initializes it.
 
Method Summary
 java.lang.Object getBean()
          Returns the newly created bean.
 BeanContext getBeanContext()
          Returns the BeanContext that caused this event.
 BeanProvider getBeanProvider()
          Returns the BeanProvider that created the new bean.
 DependencyProvider getDependencyProvider()
          Returns the DependencyProvider involved in the bean creation process.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanCreationEvent

public BeanCreationEvent(BeanContext source,
                         BeanProvider provider,
                         DependencyProvider depProvider,
                         java.lang.Object newBean)
Creates a new instance of BeanCreationEvent and initializes it.

Parameters:
source - the BeanContext that caused this event
provider - the BeanProvider that created the bean
depProvider - the DependencyProvider used for creating the bean
newBean - the newly created bean
Method Detail

getBeanContext

public BeanContext getBeanContext()
Returns the BeanContext that caused this event.

Returns:
the source BeanContext

getBeanProvider

public BeanProvider getBeanProvider()
Returns the BeanProvider that created the new bean.

Returns:
the responsible BeanProvider

getDependencyProvider

public DependencyProvider getDependencyProvider()
Returns the DependencyProvider involved in the bean creation process. This is the object that was passed to the BeanProvider when it created the new bean.

Returns:
the DependencyProvider involved when creating the bean

getBean

public java.lang.Object getBean()
Returns the newly created bean.

Returns:
the bean


Copyright © 2009 The JGUIraffe Team. All Rights Reserved.