站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

BeanDefinitionReaderUtils (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.beans.factory.support
Class BeanDefinitionReaderUtils

java.lang.Object
  extended by org.springframework.beans.factory.support.BeanDefinitionReaderUtils

public class BeanDefinitionReaderUtils
extends Object

Utility methods that are useful for bean definition reader implementations. Mainly intended for internal use.

Since:
1.1
Author:
Juergen Hoeller, Rob Harrop
See Also:
PropertiesBeanDefinitionReader, DefaultBeanDefinitionDocumentReader

Field Summary
static String GENERATED_BEAN_NAME_SEPARATOR
          Separator for generated bean names.
 
Constructor Summary
BeanDefinitionReaderUtils()
           
 
Method Summary
static AbstractBeanDefinition createBeanDefinition(String parent, String className, ClassLoader classLoader)
          Create a new RootBeanDefinition or ChildBeanDefinition for the given class name, parent, constructor arguments, and property values.
static AbstractBeanDefinition createBeanDefinition(String className, String parent, ConstructorArgumentValues cargs, MutablePropertyValues pvs, ClassLoader classLoader)
          Deprecated. in favor of createBeanDefinition(String, String, ClassLoader)
static String generateBeanName(AbstractBeanDefinition beanDefinition, BeanDefinitionRegistry beanFactory)
          Generate a bean name for the given top-level bean definition, unique within the given bean factory.
static String generateBeanName(AbstractBeanDefinition beanDefinition, BeanDefinitionRegistry beanFactory, boolean isInnerBean)
          Generate a bean name for the given bean definition, unique within the given bean factory.
static void registerBeanDefinition(BeanDefinitionHolder bdHolder, BeanDefinitionRegistry beanFactory)
          Register the given bean definition with the given bean factory.
static String registerWithGeneratedName(AbstractBeanDefinition beanDefinition, BeanDefinitionRegistry beanFactory)
          Register the given bean definition with a generated name, unique within the given bean factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GENERATED_BEAN_NAME_SEPARATOR

public static final String GENERATED_BEAN_NAME_SEPARATOR
Separator for generated bean names. If a class name or parent name is not unique, "#1", "#2" etc will be appended, until the name becomes unique.

See Also:
Constant Field Values
Constructor Detail

BeanDefinitionReaderUtils

public BeanDefinitionReaderUtils()
Method Detail

createBeanDefinition

public static AbstractBeanDefinition createBeanDefinition(String className,
                                                          String parent,
                                                          ConstructorArgumentValues cargs,
                                                          MutablePropertyValues pvs,
                                                          ClassLoader classLoader)
                                                   throws ClassNotFoundException
Deprecated. in favor of createBeanDefinition(String, String, ClassLoader)

Create a new RootBeanDefinition or ChildBeanDefinition for the given class name, parent, constructor arguments, and property values.

Parameters:
className - the name of the bean class, if any
parent - the name of the parent bean, if any
cargs - the constructor arguments, if any
pvs - the property values, if any
classLoader - the ClassLoader to use for loading bean classes (can be null to just register bean classes by name)
Returns:
the bean definition
Throws:
ClassNotFoundException - if the bean class could not be loaded
See Also:
createBeanDefinition(String, String, ClassLoader)

createBeanDefinition

public static AbstractBeanDefinition createBeanDefinition(String parent,
                                                          String className,
                                                          ClassLoader classLoader)
                                                   throws ClassNotFoundException
Create a new RootBeanDefinition or ChildBeanDefinition for the given class name, parent, constructor arguments, and property values.

Parameters:
parent - the name of the parent bean, if any
className - the name of the bean class, if any
classLoader - the ClassLoader to use for loading bean classes (can be null to just register bean classes by name)
Returns:
the bean definition
Throws:
ClassNotFoundException - if the bean class could not be loaded

generateBeanName

public static String generateBeanName(AbstractBeanDefinition beanDefinition,
                                      BeanDefinitionRegistry beanFactory,
                                      boolean isInnerBean)
                               throws BeanDefinitionStoreException
Generate a bean name for the given bean definition, unique within the given bean factory.

Parameters:
beanDefinition - the bean definition to generate a bean name for
beanFactory - the bean factory that the definition is going to be registered with (to check for existing bean names)
isInnerBean - whether the given bean definition will be registered as inner bean or as top-level bean (allowing for special name generation for inner beans versus top-level beans)
Returns:
the generated bean name
Throws:
BeanDefinitionStoreException - if no unique name can be generated for the given bean definition

generateBeanName

public static String generateBeanName(AbstractBeanDefinition beanDefinition,
                                      BeanDefinitionRegistry beanFactory)
                               throws BeanDefinitionStoreException
Generate a bean name for the given top-level bean definition, unique within the given bean factory.

Parameters:
beanDefinition - the bean definition to generate a bean name for
beanFactory - the bean factory that the definition is going to be registered with (to check for existing bean names)
Returns:
the generated bean name
Throws:
BeanDefinitionStoreException - if no unique name can be generated for the given bean definition

registerBeanDefinition

public static void registerBeanDefinition(BeanDefinitionHolder bdHolder,
                                          BeanDefinitionRegistry beanFactory)
                                   throws BeanDefinitionStoreException
Register the given bean definition with the given bean factory.

Parameters:
bdHolder - the bean definition including name and aliases
beanFactory - the bean factory to register with
Throws:
BeanDefinitionStoreException - if registration failed

registerWithGeneratedName

public static String registerWithGeneratedName(AbstractBeanDefinition beanDefinition,
                                               BeanDefinitionRegistry beanFactory)
                                        throws BeanDefinitionStoreException
Register the given bean definition with a generated name, unique within the given bean factory.

Parameters:
beanDefinition - the bean definition to generate a bean name for
beanFactory - the bean factory to register with
Returns:
the generated bean name
Throws:
BeanDefinitionStoreException - if no unique name can be generated for the given bean definition or the definition cannot be registered

The Spring Framework

Copyright © 2002-2007 The Spring Framework.