Interface ComponentDefinition
- All Superinterfaces:
BeanMetadataElement
- All Known Implementing Classes:
AbstractComponentDefinition,AdvisorComponentDefinition,AspectComponentDefinition,BeanComponentDefinition,CompositeComponentDefinition,PointcutComponentDefinition
public interface ComponentDefinition extends BeanMetadataElement
Interface that describes the logical view of a set ofBeanDefinitionsandBeanReferencesas presented in some configuration context.With the introduction of
pluggable custom XML tags, it is now possible for a single logical configuration entity, in this case an XML tag, to create multipleBeanDefinitionsandRuntimeBeanReferencesin order to provide more succinct configuration and greater convenience to end users. As such, it can no longer be assumed that each configuration entity (e.g. XML tag) maps to oneBeanDefinition. For tool vendors and other users who wish to present visualization or support for configuring Spring applications it is important that there is some mechanism in place to tie theBeanDefinitionsin theBeanFactoryback to the configuration data in a way that has concrete meaning to the end user. As such,NamespaceHandlerimplementations are able to publish events in the form of aComponentDefinitionfor each logical entity being configured. Third parties can thensubscribe to these events, allowing for a user-centric view of the bean metadata.Each
ComponentDefinitionhas asource objectwhich is configuration-specific. In the case of XML-based configuration this is typically theNodewhich contains the user supplied configuration information. In addition to this, eachBeanDefinitionenclosed in aComponentDefinitionhas its ownsource objectwhich may point to a different, more specific, set of configuration data. Beyond this, individual pieces of bean metadata such as thePropertyValuesmay also have a source object giving an even greater level of detail. Source object extraction is handled through theSourceExtractorwhich can be customized as required.Whilst direct access to important
BeanReferencesis provided throughgetBeanReferences(), tools may wish to inspect allBeanDefinitionsto gather the full set ofBeanReferences. Implementations are required to provide allBeanReferencesthat are required to validate the configuration of the overall logical entity as well as those required to provide full user visualisation of the configuration. It is expected that certainBeanReferenceswill not be important to validation or to the user view of the configuration and as such these may be omitted. A tool may wish to display any additionalBeanReferencessourced through the suppliedBeanDefinitionsbut this is not considered to be a typical case.Tools can determine the important of contained
BeanDefinitionsby checking therole identifier. The role is essentially a hint to the tool as to how important the configuration provider believes aBeanDefinitionis to the end user. It is expected that tools will not display allBeanDefinitionsfor a givenComponentDefinitionchoosing instead to filter based on the role. Tools may choose to make this filtering user configurable. Particular notice should be given to theINFRASTRUCTURE role identifier.BeanDefinitionsclassified with this role are completely unimportant to the end user and are required only for internal implementation reasons.- Since:
- 2.0
- Author:
- Rob Harrop, Juergen Hoeller
- See Also:
AbstractComponentDefinition,CompositeComponentDefinition,BeanComponentDefinition,ReaderEventListener.componentRegistered(ComponentDefinition)
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BeanDefinition[]getBeanDefinitions()Return theBeanDefinitionsthat were registered to form thisComponentDefinition.BeanReference[]getBeanReferences()Return the set ofBeanReferencesthat are considered to be important to thisComponentDefinition.StringgetDescription()Return a friendly description of the described component.BeanDefinition[]getInnerBeanDefinitions()Return theBeanDefinitionsthat represent all relevant inner beans within this component.StringgetName()Get the user-visible name of thisComponentDefinition.Methods inherited from interface org.springframework.beans.BeanMetadataElement
getSource
Method Detail
getName
String getName()
Get the user-visible name of thisComponentDefinition.This should link back directly to the corresponding configuration data for this component in a given context.
getDescription
String getDescription()
Return a friendly description of the described component.Implementations are encouraged to return the same value from
toString().
getBeanDefinitions
BeanDefinition[] getBeanDefinitions()
Return theBeanDefinitionsthat were registered to form thisComponentDefinition.It should be noted that a
ComponentDefinitionmay well be related with otherBeanDefinitionsviareferences, however these are not included as they may be not available immediately. ImportantBeanReferencesare available fromgetBeanReferences().- Returns:
- the array of BeanDefinitions, or an empty array if none
getInnerBeanDefinitions
BeanDefinition[] getInnerBeanDefinitions()
Return theBeanDefinitionsthat represent all relevant inner beans within this component.Other inner beans may exist within the associated
BeanDefinitions, however these are not considered to be needed for validation or for user visualization.- Returns:
- the array of BeanDefinitions, or an empty array if none
getBeanReferences
BeanReference[] getBeanReferences()
Return the set ofBeanReferencesthat are considered to be important to thisComponentDefinition.Other
BeanReferencesmay exist within the associatedBeanDefinitions, however these are not considered to be needed for validation or for user visualization.- Returns:
- the array of BeanReferences, or an empty array if none