Class 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 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 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    See Also:
    Serialized Form
    • Constructor Detail

      • BeanCreationEvent

        public BeanCreationEvent​(BeanContext source,
                                 BeanProvider provider,
                                 DependencyProvider depProvider,
                                 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 Object getBean()
        Returns the newly created bean.
        Returns:
        the bean