Class BeanHelper.BeanCreationContextImpl
- java.lang.Object
-
- org.apache.commons.configuration2.beanutils.BeanHelper.BeanCreationContextImpl
-
- All Implemented Interfaces:
BeanCreationContext
- Enclosing class:
- BeanHelper
private static final class BeanHelper.BeanCreationContextImpl extends java.lang.Object implements BeanCreationContext
An implementation of theBeanCreationContext
interface used byBeanHelper
to communicate with aBeanFactory
. This class contains all information required for the creation of a bean. The methods for creating and initializing bean instances are implemented by calling back to the providedBeanHelper
instance (which is the instance that created this object).
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<?>
beanClass
The class of the bean to be created.private BeanHelper
beanHelper
The association BeanHelper instance.private BeanDeclaration
data
The underlying bean declaration.private java.lang.Object
param
The parameter for the bean factory.
-
Constructor Summary
Constructors Modifier Constructor Description private
BeanCreationContextImpl(BeanHelper helper, java.lang.Class<?> beanClass, BeanDeclaration data, java.lang.Object param)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
createBean(BeanDeclaration data)
Creates a bean based on the givenBeanDeclaration
.java.lang.Class<?>
getBeanClass()
Gets the class of the bean to be created.BeanDeclaration
getBeanDeclaration()
Gets theBeanDeclaration
with the data for the new bean.java.lang.Object
getParameter()
Gets the (optional) parameter object for the bean factory.void
initBean(java.lang.Object bean, BeanDeclaration data)
Initializes a bean's property based on the givenBeanDeclaration
.
-
-
-
Field Detail
-
beanHelper
private final BeanHelper beanHelper
The association BeanHelper instance.
-
beanClass
private final java.lang.Class<?> beanClass
The class of the bean to be created.
-
data
private final BeanDeclaration data
The underlying bean declaration.
-
param
private final java.lang.Object param
The parameter for the bean factory.
-
-
Constructor Detail
-
BeanCreationContextImpl
private BeanCreationContextImpl(BeanHelper helper, java.lang.Class<?> beanClass, BeanDeclaration data, java.lang.Object param)
-
-
Method Detail
-
createBean
public java.lang.Object createBean(BeanDeclaration data)
Description copied from interface:BeanCreationContext
Creates a bean based on the givenBeanDeclaration
. This method can be used to create dependent beans needed for the initialization of the bean that is actually created.- Specified by:
createBean
in interfaceBeanCreationContext
- Parameters:
data
- theBeanDeclaration
describing the bean- Returns:
- the bean created based on this declaration
-
getBeanClass
public java.lang.Class<?> getBeanClass()
Description copied from interface:BeanCreationContext
Gets the class of the bean to be created.- Specified by:
getBeanClass
in interfaceBeanCreationContext
- Returns:
- the bean class
-
getBeanDeclaration
public BeanDeclaration getBeanDeclaration()
Description copied from interface:BeanCreationContext
Gets theBeanDeclaration
with the data for the new bean. This data is used to initialize the bean's properties.- Specified by:
getBeanDeclaration
in interfaceBeanCreationContext
- Returns:
- the
BeanDeclaration
defining the bean to be created
-
getParameter
public java.lang.Object getParameter()
Description copied from interface:BeanCreationContext
Gets the (optional) parameter object for the bean factory. This is a mechanism which can be used to pass custom parameters to aBeanFactory
.- Specified by:
getParameter
in interfaceBeanCreationContext
- Returns:
- the parameter for the bean factory
-
initBean
public void initBean(java.lang.Object bean, BeanDeclaration data)
Description copied from interface:BeanCreationContext
Initializes a bean's property based on the givenBeanDeclaration
.- Specified by:
initBean
in interfaceBeanCreationContext
- Parameters:
bean
- the bean to be initializeddata
- theBeanDeclaration
with initialization data for this bean
-
-