BeanDeclarationpublic class CombinedBeanDeclaration extends java.lang.Object implements BeanDeclaration
A special implementation of the BeanDeclaration interface which
allows combining multiple BeanDeclaration objects.
An instance of this class can be used if a bean is defined using multiple sources. For instance, there can be one definition with default values and one with actual values; if actual values are provided, they are used; otherwise, the default values apply.
When constructing an instance an arbitrary number of child
BeanDeclaration objects can be specified. The implementations of the
BeanDeclaration methods implement a logical combination of the data
returned by these child declarations. The order in which child declarations
are added is relevant; first entries take precedence over later ones. The
comments of the single methods explain in which way a combination of the
child declarations is built.
| Constructor | Description |
|---|---|
CombinedBeanDeclaration(BeanDeclaration... decl) |
Creates a new instance of
CombinedBeanDeclaration and initializes
it with the given child declarations. |
| Modifier and Type | Method | Description |
|---|---|---|
java.lang.String |
getBeanClassName() |
Returns the name of the bean class, from which an instance is to be
created.
|
java.lang.String |
getBeanFactoryName() |
Returns the name of the
BeanFactory that should be used
for creating the bean instance. |
java.lang.Object |
getBeanFactoryParameter() |
Here an arbitrary object can be returned that will be passed to the bean
factory.
|
java.util.Map<java.lang.String,java.lang.Object> |
getBeanProperties() |
Returns a map with properties that should be initialized on the newly
created bean.
|
java.util.Collection<ConstructorArg> |
getConstructorArgs() |
Returns a collection with constructor arguments.
|
java.util.Map<java.lang.String,java.lang.Object> |
getNestedBeanDeclarations() |
Returns a map with declarations for beans that should be set as
properties of the newly created bean.
|
public CombinedBeanDeclaration(BeanDeclaration... decl)
CombinedBeanDeclaration and initializes
it with the given child declarations.decl - the child declarationsjava.lang.NullPointerException - if the array with child declarations is
nullpublic java.lang.String getBeanFactoryName()
BeanFactory that should be used
for creating the bean instance. This can be null, then a default
factory will be used. This implementation iterates over the list of child
declarations and asks them for a bean factory name. The first
non-null value is returned. If none of the child declarations have
a defined bean factory name, result is null.getBeanFactoryName in interface BeanDeclarationpublic java.lang.Object getBeanFactoryParameter()
getBeanFactoryParameter in interface BeanDeclarationpublic java.lang.String getBeanClassName()
getBeanClassName in interface BeanDeclarationpublic java.util.Map<java.lang.String,java.lang.Object> getBeanProperties()
getBeanProperties in interface BeanDeclarationpublic java.util.Map<java.lang.String,java.lang.Object> getNestedBeanDeclarations()
BeanDeclaration
implementations or collections thereof. They will be treated like this
declaration (in a recursive manner), and the resulting beans are
assigned to the corresponding properties. This implementation creates a union of the nested bean
declarations returned by all child declarations. If a complex property is
defined in multiple child declarations, the declaration that comes before
in the list of children takes precedence.getNestedBeanDeclarations in interface BeanDeclarationpublic java.util.Collection<ConstructorArg> getConstructorArgs()
getConstructorArgs in interface BeanDeclarationCopyright © 2001–2018. All rights reserved.