org.springframework.beans.factory.support
Class SimpleInstantiationStrategy

java.lang.Object
  extended by org.springframework.beans.factory.support.SimpleInstantiationStrategy
All Implemented Interfaces:
InstantiationStrategy
Direct Known Subclasses:
CglibSubclassingInstantiationStrategy

public class SimpleInstantiationStrategy
extends java.lang.Object
implements InstantiationStrategy

Simple object instantiation strategy for use in a BeanFactory.

Does not support Method Injection, although it provides hooks for subclasses to override to add Method Injection support, for example by overriding methods.

Since:
1.1
Author:
Rod Johnson, Juergen Hoeller

Constructor Summary
SimpleInstantiationStrategy()
           
 
Method Summary
 java.lang.Object instantiate(RootBeanDefinition beanDefinition, java.lang.String beanName, BeanFactory owner)
          Return an instance of the bean with the given name in this factory.
 java.lang.Object instantiate(RootBeanDefinition beanDefinition, java.lang.String beanName, BeanFactory owner, java.lang.reflect.Constructor ctor, java.lang.Object[] args)
          Return an instance of the bean with the given name in this factory, creating it via the given constructor.
 java.lang.Object instantiate(RootBeanDefinition beanDefinition, java.lang.String beanName, BeanFactory owner, java.lang.Object factoryBean, java.lang.reflect.Method factoryMethod, java.lang.Object[] args)
          Return an instance of the bean with the given name in this factory, creating it via the given factory method.
protected  java.lang.Object instantiateWithMethodInjection(RootBeanDefinition beanDefinition, java.lang.String beanName, BeanFactory owner)
          Subclasses can override this method, which is implemented to throw UnsupportedOperationException, if they can instantiate an object with the Method Injection specified in the given RootBeanDefinition.
protected  java.lang.Object instantiateWithMethodInjection(RootBeanDefinition beanDefinition, java.lang.String beanName, BeanFactory owner, java.lang.reflect.Constructor ctor, java.lang.Object[] args)
          Subclasses can override this method, which is implemented to throw UnsupportedOperationException, if they can instantiate an object with the Method Injection specified in the given RootBeanDefinition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleInstantiationStrategy

public SimpleInstantiationStrategy()
Method Detail

instantiate

public java.lang.Object instantiate(RootBeanDefinition beanDefinition,
                                    java.lang.String beanName,
                                    BeanFactory owner)
Description copied from interface: InstantiationStrategy
Return an instance of the bean with the given name in this factory.

Specified by:
instantiate in interface InstantiationStrategy
Parameters:
beanDefinition - the bean definition
beanName - name of the bean when it's created in this context. The name can be null if we're autowiring a bean that doesn't belong to the factory.
owner - owning BeanFactory
Returns:
a bean instance for this bean definition

instantiateWithMethodInjection

protected java.lang.Object instantiateWithMethodInjection(RootBeanDefinition beanDefinition,
                                                          java.lang.String beanName,
                                                          BeanFactory owner)
Subclasses can override this method, which is implemented to throw UnsupportedOperationException, if they can instantiate an object with the Method Injection specified in the given RootBeanDefinition. Instantiation should use a no-arg constructor.


instantiate

public java.lang.Object instantiate(RootBeanDefinition beanDefinition,
                                    java.lang.String beanName,
                                    BeanFactory owner,
                                    java.lang.reflect.Constructor ctor,
                                    java.lang.Object[] args)
Description copied from interface: InstantiationStrategy
Return an instance of the bean with the given name in this factory, creating it via the given constructor.

Specified by:
instantiate in interface InstantiationStrategy
Parameters:
beanDefinition - the bean definition
beanName - name of the bean when it's created in this context. The name can be null if we're autowiring a bean that doesn't belong to the factory.
owner - owning BeanFactory
ctor - the constructor to use
args - the constructor arguments to apply
Returns:
a bean instance for this bean definition

instantiateWithMethodInjection

protected java.lang.Object instantiateWithMethodInjection(RootBeanDefinition beanDefinition,
                                                          java.lang.String beanName,
                                                          BeanFactory owner,
                                                          java.lang.reflect.Constructor ctor,
                                                          java.lang.Object[] args)
Subclasses can override this method, which is implemented to throw UnsupportedOperationException, if they can instantiate an object with the Method Injection specified in the given RootBeanDefinition. Instantiation should use the given constructor and parameters.


instantiate

public java.lang.Object instantiate(RootBeanDefinition beanDefinition,
                                    java.lang.String beanName,
                                    BeanFactory owner,
                                    java.lang.Object factoryBean,
                                    java.lang.reflect.Method factoryMethod,
                                    java.lang.Object[] args)
Description copied from interface: InstantiationStrategy
Return an instance of the bean with the given name in this factory, creating it via the given factory method.

Specified by:
instantiate in interface InstantiationStrategy
Parameters:
beanDefinition - bean definition
beanName - name of the bean when it's created in this context. The name can be null if we're autowiring a bean that doesn't belong to the factory.
owner - owning BeanFactory
factoryBean - the factory bean instance to call the factory method on, or null in case of a static factory method
factoryMethod - the factory method to use
args - the factory method arguments to apply
Returns:
a bean instance for this bean definition