The Spring Framework

org.springframework.beans.factory.support
Class BeanDefinitionValueResolver

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

 class BeanDefinitionValueResolver
extends Object

Helper class for use by BeanFactory implementations, resolving values contained in BeanDefinition objects into the actual values applied to the target bean instance.

Works on an AbstractBeanFactory and a plain BeanDefinition object. Used by AbstractAutowireCapableBeanFactory.

Since:
1.2
Author:
Juergen Hoeller
See Also:
AbstractAutowireCapableBeanFactory

Field Summary
static String GENERATED_BEAN_NAME_SEPARATOR
          Separator for generated bean names.
protected  Log logger
           
 
Constructor Summary
BeanDefinitionValueResolver(AbstractBeanFactory beanFactory, String beanName, BeanDefinition beanDefinition)
          Create a new BeanDefinitionValueResolver for the given BeanFactory and BeanDefinition.
 
Method Summary
protected  Class resolveTargetType(TypedStringValue value)
          Resolve the target type in the given TypedStringValue.
 Object resolveValueIfNecessary(String argName, Object value)
          Given a PropertyValue, return a value, resolving any references to other beans in the factory if necessary.
 
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

logger

protected final Log logger
Constructor Detail

BeanDefinitionValueResolver

public BeanDefinitionValueResolver(AbstractBeanFactory beanFactory,
                                   String beanName,
                                   BeanDefinition beanDefinition)
Create a new BeanDefinitionValueResolver for the given BeanFactory and BeanDefinition.

Parameters:
beanFactory - the BeanFactory to resolve against
beanName - the name of the bean that we work on
beanDefinition - the BeanDefinition of the bean that we work on
Method Detail

resolveValueIfNecessary

public Object resolveValueIfNecessary(String argName,
                                      Object value)
                               throws BeansException
Given a PropertyValue, return a value, resolving any references to other beans in the factory if necessary. The value could be:
  • A BeanDefinition, which leads to the creation of a corresponding new bean instance. Singleton flags and names of such "inner beans" are always ignored: Inner beans are anonymous prototypes.
  • A RuntimeBeanReference, which must be resolved.
  • A ManagedList. This is a special collection that may contain RuntimeBeanReferences or Collections that will need to be resolved.
  • A ManagedSet. May also contain RuntimeBeanReferences or Collections that will need to be resolved.
  • A ManagedMap. In this case the value may be a RuntimeBeanReference or Collection that will need to be resolved.
  • An ordinary object or null, in which case it's left alone.

    Throws:
    BeansException

  • resolveTargetType

    protected Class resolveTargetType(TypedStringValue value)
                               throws ClassNotFoundException
    Resolve the target type in the given TypedStringValue.

    Parameters:
    value - the TypedStringValue to resolve
    Returns:
    the resolved target type (or null if none specified)
    Throws:
    ClassNotFoundException - if the specified type cannot be resolved
    See Also:
    TypedStringValue.resolveTargetType(java.lang.ClassLoader)

    The Spring Framework

    Copyright © 2002-2006 The Spring Framework.