Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2002-2007 the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.springframework.beans.factory.support;
 
 import java.util.Set;
 
A root bean definition represents the merged bean definition that backs a specific bean in a Spring BeanFactory at runtime. It might have been created from multiple original bean definitions that inherit from each other, typically registered as GenericBeanDefinitions. A root bean definition is essentially the 'unified' bean definition view at runtime.

Root bean definitions may also be used for registering individual bean definitions in the configuration phase. However, since Spring 2.5, the preferred way to register bean definitions programmatically is the GenericBeanDefinition class. GenericBeanDefinition has the advantage that it allows to dynamically define parent dependencies, not 'hard-coding' the role as a root bean definition.

Author(s):
Rod Johnson
Juergen Hoeller
See also:
GenericBeanDefinition
ChildBeanDefinition
 
 public class RootBeanDefinition extends AbstractBeanDefinition {
 
 	private final Set externallyManagedConfigMembers = Collections.synchronizedSet(new HashSet());
 
 	private final Set externallyManagedInitMethods = Collections.synchronizedSet(new HashSet());
 
 	private final Set externallyManagedDestroyMethods = Collections.synchronizedSet(new HashSet());

Package-visible field for caching the resolved constructor or factory method
 
Package-visible field for caching fully resolved constructor arguments
 
Package-visible field for caching partly prepared constructor arguments
 
Package-visible field that marks the constructor arguments as resolved
 
 	volatile boolean constructorArgumentsResolved = false;

Package-visible field that indicates a before-instantiation post-processor having kicked in
 
Package-visible field that indicates MergedBeanDefinitionPostProcessor having been applied
 
 	volatile boolean postProcessed = false;


 
 	public RootBeanDefinition() {
 		super();
 	}

Create a new RootBeanDefinition for a singleton.

Parameters:
beanClass the class of the bean to instantiate
 
 	public RootBeanDefinition(Class beanClass) {
 		super();
 		setBeanClass(beanClass);
 	}

Create a new RootBeanDefinition with the given singleton status.

Parameters:
beanClass the class of the bean to instantiate
singleton the singleton status of the bean
	public RootBeanDefinition(Class beanClassboolean singleton) {
		super();
		setBeanClass(beanClass);
		setSingleton(singleton);
	}

Create a new RootBeanDefinition for a singleton, using the given autowire mode.

Parameters:
beanClass the class of the bean to instantiate
autowireMode by name or type, using the constants in this interface
	public RootBeanDefinition(Class beanClassint autowireMode) {
		super();
		setBeanClass(beanClass);
		setAutowireMode(autowireMode);
	}

Create a new RootBeanDefinition for a singleton, using the given autowire mode.

Parameters:
beanClass the class of the bean to instantiate
autowireMode by name or type, using the constants in this interface
dependencyCheck whether to perform a dependency check for objects (not applicable to autowiring a constructor, thus ignored there)
	public RootBeanDefinition(Class beanClassint autowireModeboolean dependencyCheck) {
		super();
		setBeanClass(beanClass);
		setAutowireMode(autowireMode);
		if (dependencyCheck && getResolvedAutowireMode() != ) {
		}
	}

Create a new RootBeanDefinition for a singleton, providing property values.

Parameters:
beanClass the class of the bean to instantiate
pvs the property values to apply
	public RootBeanDefinition(Class beanClassMutablePropertyValues pvs) {
		super(nullpvs);
		setBeanClass(beanClass);
	}

Create a new RootBeanDefinition with the given singleton status, providing property values.

Parameters:
beanClass the class of the bean to instantiate
pvs the property values to apply
singleton the singleton status of the bean
	public RootBeanDefinition(Class beanClassMutablePropertyValues pvsboolean singleton) {
		super(nullpvs);
		setBeanClass(beanClass);
		setSingleton(singleton);
	}

Create a new RootBeanDefinition for a singleton, providing constructor arguments and property values.

Parameters:
beanClass the class of the bean to instantiate
cargs the constructor argument values to apply
pvs the property values to apply
		super(cargspvs);
		setBeanClass(beanClass);
	}

Create a new RootBeanDefinition for a singleton, providing constructor arguments and property values.

Takes a bean class name to avoid eager loading of the bean class.

Parameters:
beanClassName the name of the class to instantiate
cargs the constructor argument values to apply
pvs the property values to apply
		super(cargspvs);
		setBeanClassName(beanClassName);
	}

Create a new RootBeanDefinition as deep copy of the given bean definition.

Parameters:
original the original bean definition to copy from
		super((BeanDefinitionoriginal);
	}

Create a new RootBeanDefinition as deep copy of the given bean definition.

Parameters:
original the original bean definition to copy from
		super(original);
	}
	public String getParentName() {
		return null;
	}
	public void setParentName(String parentName) {
		if (parentName != null) {
			throw new IllegalArgumentException("Root bean cannot be changed into a child bean with parent reference");
		}
	}
	public void registerExternallyManagedConfigMember(Member configMember) {
	}
	public boolean isExternallyManagedConfigMember(Member configMember) {
		return this..contains(configMember);
	}
	public void registerExternallyManagedInitMethod(String initMethod) {
	}
	public boolean isExternallyManagedInitMethod(String initMethod) {
		return this..contains(initMethod);
	}
	public void registerExternallyManagedDestroyMethod(String destroyMethod) {
	}
	public boolean isExternallyManagedDestroyMethod(String destroyMethod) {
		return this..contains(destroyMethod);
	}
		return new RootBeanDefinition(this);
	}
	public boolean equals(Object other) {
		return (this == other || (other instanceof RootBeanDefinition && super.equals(other)));
	}
	public String toString() {
		return "Root bean: " + super.toString();
	}
New to GrepCode? Check out our FAQ X