Package org.springframework.beans.factory.parsing

# Class CompositeComponentDefinition

java.lang.Object
org.springframework.beans.factory.parsing.AbstractComponentDefinition
org.springframework.beans.factory.parsing.CompositeComponentDefinition

All Implemented Interfaces:
  `BeanMetadataElement`, `ComponentDefinition`

public class CompositeComponentDefinition extends AbstractComponentDefinition
`ComponentDefinition` implementation that holds one or more nested `ComponentDefinition` instances, aggregating them into a named group of components.

Since:
  2.0.1
Author:
  Juergen Hoeller
See Also:
  - `getNestedComponents()`

## Constructor Summary

Constructors
Constructor
Description
`CompositeComponentDefinition(String name, Object source)`
Create a new CompositeComponentDefinition.

## Method Summary

Modifier and Type
Method
Description
`void`
`addNestedComponent(ComponentDefinition component)`
Add the given component as nested element of this composite component.
`String`
`getName()`
Get the user-visible name of this `ComponentDefinition`.
`ComponentDefinition[]`
`getNestedComponents()`
Return the nested components that this composite component holds.
`Object`
`getSource()`
Return the configuration source `Object` for this metadata element (may be `null`).

### Methods inherited from class org.springframework.beans.factory.parsing.AbstractComponentDefinition

`getBeanDefinitions, getBeanReferences, getDescription, getInnerBeanDefinitions, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### CompositeComponentDefinition

public CompositeComponentDefinition(String name, @Nullable Object source)
Create a new CompositeComponentDefinition.

Parameters:
  `name` - the name of the composite component
  `source` - the source element that defines the root of the composite component

## Method Details

### getName

public String getName()
Description copied from interface: `ComponentDefinition`
Get the user-visible name of this `ComponentDefinition`.

This should link back directly to the corresponding configuration data for this component in a given context.

### getSource

@Nullable public Object getSource()
Description copied from interface: `BeanMetadataElement`
Return the configuration source `Object` for this metadata element (may be `null`).

### addNestedComponent

public void addNestedComponent(ComponentDefinition component)
Add the given component as nested element of this composite component.

Parameters:
  `component` - the nested component to add

### getNestedComponents

public ComponentDefinition[] getNestedComponents()
Return the nested components that this composite component holds.

Returns:
  the array of nested components, or an empty array if none