接口 ComponentDefinition
- 所有超级接口:
BeanMetadataElement
- 所有已知实现类:
AbstractComponentDefinition
,AdvisorComponentDefinition
,AspectComponentDefinition
,BeanComponentDefinition
,CompositeComponentDefinition
,PointcutComponentDefinition
public interface ComponentDefinition extends BeanMetadataElement
Interface that describes the logical view of a set ofBeanDefinitions
andBeanReferences
as 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 multipleBeanDefinitions
andRuntimeBeanReferences
in 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 theBeanDefinitions
in theBeanFactory
back to the configuration data in a way that has concrete meaning to the end user. As such,NamespaceHandler
implementations are able to publish events in the form of aComponentDefinition
for each logical entity being configured. Third parties can thensubscribe to these events
, allowing for a user-centric view of the bean metadata.Each
ComponentDefinition
has asource object
which is configuration-specific. In the case of XML-based configuration this is typically theNode
which contains the user supplied configuration information. In addition to this, eachBeanDefinition
enclosed in aComponentDefinition
has its ownsource object
which may point to a different, more specific, set of configuration data. Beyond this, individual pieces of bean metadata such as thePropertyValues
may also have a source object giving an even greater level of detail. Source object extraction is handled through theSourceExtractor
which can be customized as required.Whilst direct access to important
BeanReferences
is provided throughgetBeanReferences()
, tools may wish to inspect allBeanDefinitions
to gather the full set ofBeanReferences
. Implementations are required to provide allBeanReferences
that 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 certainBeanReferences
will 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 additionalBeanReferences
sourced through the suppliedBeanDefinitions
but this is not considered to be a typical case.Tools can determine the important of contained
BeanDefinitions
by checking therole identifier
. The role is essentially a hint to the tool as to how important the configuration provider believes aBeanDefinition
is to the end user. It is expected that tools will not display allBeanDefinitions
for a givenComponentDefinition
choosing 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
.BeanDefinitions
classified with this role are completely unimportant to the end user and are required only for internal implementation reasons.- 从以下版本开始:
- 2.0
- 作者:
- Rob Harrop, Juergen Hoeller
- 另请参阅:
AbstractComponentDefinition
,CompositeComponentDefinition
,BeanComponentDefinition
,ReaderEventListener.componentRegistered(ComponentDefinition)
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 BeanDefinition[]
getBeanDefinitions()
Return theBeanDefinitions
that were registered to form thisComponentDefinition
.BeanReference[]
getBeanReferences()
Return the set ofBeanReferences
that are considered to be important to thisComponentDefinition
.String
getDescription()
Return a friendly description of the described component.BeanDefinition[]
getInnerBeanDefinitions()
Return theBeanDefinitions
that represent all relevant inner beans within this component.String
getName()
Get the user-visible name of thisComponentDefinition
.从接口继承的方法 org.springframework.beans.BeanMetadataElement
getSource
方法详细资料
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 theBeanDefinitions
that were registered to form thisComponentDefinition
.It should be noted that a
ComponentDefinition
may well be related with otherBeanDefinitions
viareferences
, however these are not included as they may be not available immediately. ImportantBeanReferences
are available fromgetBeanReferences()
.- 返回:
- the array of BeanDefinitions, or an empty array if none
getInnerBeanDefinitions
BeanDefinition[] getInnerBeanDefinitions()
Return theBeanDefinitions
that 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.- 返回:
- the array of BeanDefinitions, or an empty array if none
getBeanReferences
BeanReference[] getBeanReferences()
Return the set ofBeanReferences
that are considered to be important to thisComponentDefinition
.Other
BeanReferences
may exist within the associatedBeanDefinitions
, however these are not considered to be needed for validation or for user visualization.- 返回:
- the array of BeanReferences, or an empty array if none