Package org.apache.commons.configuration2.beanutils

# Interface BeanCreationContext

public interface BeanCreationContext

Definition of a context object storing all required information for the creation of a bean.

An object implementing this interface is passed to a `BeanFactory`. The interface also contains methods for the creation and initialization of nested beans (for example constructor arguments or complex properties of the bean to be created).

Since:
  2.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `createBean(BeanDeclaration data)`
  Creates a bean based on the given `BeanDeclaration`.
  `Class<?>`
  `getBeanClass()`
  Gets the class of the bean to be created.
  `BeanDeclaration`
  `getBeanDeclaration()`
  Gets the `BeanDeclaration` with the data for the new bean.
  `Object`
  `getParameter()`
  Gets the (optional) parameter object for the bean factory.
  `void`
  `initBean(Object bean, BeanDeclaration data)`
  Initializes a bean's property based on the given `BeanDeclaration`.

- ## Method Details

  - ### createBean

    Object createBean(BeanDeclaration data)
    Creates a bean based on the given `BeanDeclaration`. This method can be used to create dependent beans needed for the initialization of the bean that is actually created.
    Parameters:
      `data` - the `BeanDeclaration` describing the bean
    Returns:
      the bean created based on this declaration

  - ### getBeanClass

    Class<?> getBeanClass()
    Gets the class of the bean to be created.
    Returns:
      the bean class

  - ### getBeanDeclaration

    BeanDeclaration getBeanDeclaration()
    Gets the `BeanDeclaration` with the data for the new bean. This data is used to initialize the bean's properties.
    Returns:
      the `BeanDeclaration` defining the bean to be created

  - ### getParameter

    Object getParameter()
    Gets the (optional) parameter object for the bean factory. This is a mechanism which can be used to pass custom parameters to a `BeanFactory`.
    Returns:
      the parameter for the bean factory

  - ### initBean

    void initBean(Object bean, BeanDeclaration data)
    Initializes a bean's property based on the given `BeanDeclaration`.
    Parameters:
      `bean` - the bean to be initialized
      `data` - the `BeanDeclaration` with initialization data for this bean