org.springframework.beans.factory.support
Interface BeanDefinitionRegistry

All Known Implementing Classes:
DefaultListableBeanFactory

public interface BeanDefinitionRegistry

Interface for registries that hold bean definitions, i.e. RootBeanDefinition and ChildBeanDefinition instances.

Typically implemented by bean factories that work with the AbstractBeanDefinition hierarchy internally.

Author:
Juergen Hoeller
Version: $Id: BeanDefinitionRegistry.java,v 1.5 2004/01/20 11:26:43 jhoeller Exp $
Since: 26.11.2003

Method Summary
 booleancontainsBeanDefinition(String name)
          Check if this registry contains a bean definition with the given name.
 String[]getAliases(String name)
          Return the aliases for the given bean name, if defined.
 AbstractBeanDefinitiongetBeanDefinition(String name)
          Return the bean definition for the given bean name.
 intgetBeanDefinitionCount()
          Return the number of beans defined in the registry.
 String[]getBeanDefinitionNames()
          Return the names of all beans defined in this registry.
 voidregisterAlias(String name, String alias)
          Given a bean name, create an alias.
 voidregisterBeanDefinition(String name, AbstractBeanDefinition beanDefinition)
          Register a new bean definition with this registry.

Method Detail

containsBeanDefinition

public boolean containsBeanDefinition(String name)
Check if this registry contains a bean definition with the given name.
Parameters:
name - the name of the bean to look for
Returns: if this bean factory contains a bean definition with the given name

getAliases

public String[] getAliases(String name)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
Return the aliases for the given bean name, if defined.

Will ask the parent factory if the bean cannot be found in this factory instance.

Parameters:
name - the bean name to check for aliases
Returns: the aliases, or an empty array if none
Throws:
NoSuchBeanDefinitionException - if there's no such bean definition

getBeanDefinition

public AbstractBeanDefinition getBeanDefinition(String name)
throws org.springframework.beans.BeansException
Return the bean definition for the given bean name.
Parameters:
name - name of the bean to find a definition for
Returns: the BeanDefinition for this prototype name. Must never return null.
Throws:
org.springframework.beans.factory.NoSuchBeanDefinitionException if - the bean definition cannot be resolved
BeansException - in case of errors

getBeanDefinitionCount

public int getBeanDefinitionCount()
Return the number of beans defined in the registry.
Returns: the number of beans defined in the registry

getBeanDefinitionNames

public String[] getBeanDefinitionNames()
Return the names of all beans defined in this registry.
Returns: the names of all beans defined in this registry, or an empty array if none defined

registerAlias

public void registerAlias(String name, String alias)
throws org.springframework.beans.BeansException
Given a bean name, create an alias. We typically use this method to support names that are illegal within XML ids (used for bean names).
Parameters:
name - the name of the bean
alias - alias that will behave the same as the bean name
Throws:
org.springframework.beans.factory.NoSuchBeanDefinitionException if - there is no bean with the given name
BeansException - if the alias is already in use

registerBeanDefinition

public void registerBeanDefinition(String name, AbstractBeanDefinition beanDefinition)
throws org.springframework.beans.BeansException
Register a new bean definition with this registry. Must support RootBeanDefinition and ChildBeanDefinition.
Parameters:
name - the name of the bean instance to register
beanDefinition - definition of the bean instance to register
Throws:
BeansException - if the bean definition is invalid
See Also:
RootBeanDefinition, ChildBeanDefinition