|
The Spring Framework | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.core.AttributeAccessorSupport
org.springframework.beans.factory.support.AbstractBeanDefinition
public abstract class AbstractBeanDefinition
Base class for concrete, full-fledged
BeanDefinition classes,
factoring out common properties of RootBeanDefinition and
ChildBeanDefinition.
The autowire constants match the ones defined in the
AutowireCapableBeanFactory
interface.
RootBeanDefinition,
ChildBeanDefinition,
Serialized Form| Field Summary | |
|---|---|
static int |
AUTOWIRE_AUTODETECT
Constant that indicates determining an appropriate autowire strategy through introspection of the bean class. |
static int |
AUTOWIRE_BY_NAME
Constant that indicates autowiring bean properties by name. |
static int |
AUTOWIRE_BY_TYPE
Constant that indicates autowiring bean properties by type. |
static int |
AUTOWIRE_CONSTRUCTOR
Constant that indicates autowiring a constructor. |
static int |
AUTOWIRE_NO
Constant that indicates no autowiring at all. |
static int |
DEPENDENCY_CHECK_ALL
Constant that indicates dependency checking for all properties (object references as well as "simple" properties). |
static int |
DEPENDENCY_CHECK_NONE
Constant that indicates no dependency check at all. |
static int |
DEPENDENCY_CHECK_OBJECTS
Constant that indicates dependency checking for object references. |
static int |
DEPENDENCY_CHECK_SIMPLE
Constant that indicates dependency checking for "simple" properties. |
| Fields inherited from interface org.springframework.beans.factory.config.BeanDefinition |
|---|
ROLE_APPLICATION, ROLE_INFRASTRUCTURE, ROLE_SUPPORT, SCOPE_PROTOTYPE, SCOPE_SINGLETON |
| Constructor Summary | |
|---|---|
protected |
AbstractBeanDefinition()
Create a new AbstractBeanDefinition with default settings. |
protected |
AbstractBeanDefinition(AbstractBeanDefinition original)
Create a new AbstractBeanDefinition as deep copy of the given bean definition. |
protected |
AbstractBeanDefinition(ConstructorArgumentValues cargs,
MutablePropertyValues pvs)
Create a new AbstractBeanDefinition with the given constructor argument values and property values. |
| Method Summary | |
|---|---|
boolean |
equals(Object other)
|
int |
getAutowireMode()
Return the autowire mode as specified in the bean definition. |
Class |
getBeanClass()
Return the class of the wrapped bean. |
String |
getBeanClassName()
Return the class name of the wrapped bean. |
ConstructorArgumentValues |
getConstructorArgumentValues()
Return constructor argument values for this bean (never null). |
int |
getDependencyCheck()
Return the dependency check code. |
String[] |
getDependsOn()
Return the bean names that this bean depends on. |
String |
getDestroyMethodName()
Return the name of the destroy method. |
String |
getFactoryBeanName()
Returns the factory bean name, if any. |
String |
getFactoryMethodName()
Return a factory method, if any. |
String |
getInitMethodName()
Return the name of the initializer method. |
MethodOverrides |
getMethodOverrides()
Return information about methods to be overridden by the IoC container. |
MutablePropertyValues |
getPropertyValues()
Return property values for this bean (never null). |
int |
getResolvedAutowireMode()
Return the resolved autowire code, (resolving AUTOWIRE_AUTODETECT to AUTOWIRE_CONSTRUCTOR or AUTOWIRE_BY_TYPE). |
String |
getResourceDescription()
Return a description of the resource that this bean definition came from. |
int |
getRole()
Return the role hint for this BeanDefinition. |
String |
getScope()
Return the name of the target scope for the bean. |
Object |
getSource()
Return the configuration source Object for this metadata element
(may be null). |
boolean |
hasBeanClass()
Return whether this definition specifies a bean class. |
boolean |
hasConstructorArgumentValues()
Return if there are constructor argument values defined for this bean. |
int |
hashCode()
|
boolean |
isAbstract()
Return whether this bean is "abstract", i.e. not meant to be instantiated itself but rather just serving as parent for concrete child bean definitions. |
boolean |
isAutowireCandidate()
Return whether this bean is a candidate for getting autowired into some other bean. |
boolean |
isEnforceDestroyMethod()
Indicate whether the configured destroy method is the default. |
boolean |
isEnforceInitMethod()
Indicate whether the configured init method is the default. |
boolean |
isLazyInit()
Return whether this bean should be lazily initialized, i.e. not eagerly instantiated on startup. |
boolean |
isPrototype()
Return whether this a Prototype, with an independent instance returned for each call. |
boolean |
isSingleton()
Return whether this a Singleton, with a single shared instance returned from all calls. |
boolean |
isSynthetic()
Return whether this bean definition is 'synthetic', that is, not defined by the application itself. |
void |
overrideFrom(AbstractBeanDefinition other)
Override settings in this bean definition (assumably a copied parent from a parent-child inheritance relationship) from the given bean definition (assumably the child). |
protected void |
prepareMethodOverride(MethodOverride mo)
Validate and prepare the given method override. |
void |
prepareMethodOverrides()
Validate and prepare the method overrides defined for this bean. |
Class |
resolveBeanClass(ClassLoader classLoader)
Determine the class of the wrapped bean, resolving it from a specified class name if necessary. |
void |
setAbstract(boolean abstractFlag)
Set if this bean is "abstract", i.e. not meant to be instantiated itself but rather just serving as parent for concrete child bean definitions. |
void |
setAutowireCandidate(boolean autowireCandidate)
Set whether this bean is a candidate for getting autowired into some other bean. |
void |
setAutowireMode(int autowireMode)
Set the autowire mode. |
void |
setBeanClass(Class beanClass)
Specify the class for this bean. |
void |
setBeanClassName(String beanClassName)
Specify the class name for this bean. |
void |
setConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues)
Specify constructor argument values for this bean. |
void |
setDependencyCheck(int dependencyCheck)
Set the dependency check code. |
void |
setDependsOn(String[] dependsOn)
Set the names of the beans that this bean depends on being initialized. |
void |
setDestroyMethodName(String destroyMethodName)
Set the name of the destroy method. |
void |
setEnforceDestroyMethod(boolean enforceDestroyMethod)
Specify whether or not the configured destroy method is the default. |
void |
setEnforceInitMethod(boolean enforceInitMethod)
Specify whether or not the configured init method is the default. |
void |
setFactoryBeanName(String factoryBeanName)
Specify the factory bean to use, if any. |
void |
setFactoryMethodName(String factoryMethodName)
Specify a factory method, if any. |
void |
setInitMethodName(String initMethodName)
Set the name of the initializer method. |
void |
setLazyInit(boolean lazyInit)
Set whether this bean should be lazily initialized. |
void |
setMethodOverrides(MethodOverrides methodOverrides)
Specify method overrides for the bean, if any. |
void |
setPropertyValues(MutablePropertyValues propertyValues)
Specify property values for this bean, if any. |
void |
setResourceDescription(String resourceDescription)
Set a description of the resource that this bean definition came from (for the purpose of showing context in case of errors). |
void |
setRole(int role)
Set the role hint for this BeanDefinition. |
void |
setScope(String scope)
Set the name of the target scope for the bean. |
void |
setSingleton(boolean singleton)
Set if this a Singleton, with a single, shared instance returned on all calls. |
void |
setSource(Object source)
Set the configuration source Object for this metadata element. |
void |
setSynthetic(boolean synthetic)
Set whether this bean definition is 'synthetic', that is, not defined by the application itself (for example, an infrastructure bean such as a helper for auto-proxying, created through <aop:config>). |
String |
toString()
|
void |
validate()
Validate this bean definition. |
| Methods inherited from class org.springframework.core.AttributeAccessorSupport |
|---|
attributeNames, copyAttributesFrom, getAttribute, hasAttribute, removeAttribute, setAttribute |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.springframework.core.AttributeAccessor |
|---|
attributeNames, getAttribute, hasAttribute, removeAttribute, setAttribute |
| Field Detail |
|---|
public static final int AUTOWIRE_NO
setAutowireMode(int),
Constant Field Valuespublic static final int AUTOWIRE_BY_NAME
setAutowireMode(int),
Constant Field Valuespublic static final int AUTOWIRE_BY_TYPE
setAutowireMode(int),
Constant Field Valuespublic static final int AUTOWIRE_CONSTRUCTOR
setAutowireMode(int),
Constant Field Valuespublic static final int AUTOWIRE_AUTODETECT
setAutowireMode(int),
Constant Field Valuespublic static final int DEPENDENCY_CHECK_NONE
setDependencyCheck(int),
Constant Field Valuespublic static final int DEPENDENCY_CHECK_OBJECTS
setDependencyCheck(int),
Constant Field Valuespublic static final int DEPENDENCY_CHECK_SIMPLE
public static final int DEPENDENCY_CHECK_ALL
setDependencyCheck(int),
Constant Field Values| Constructor Detail |
|---|
protected AbstractBeanDefinition()
protected AbstractBeanDefinition(ConstructorArgumentValues cargs, MutablePropertyValues pvs)
protected AbstractBeanDefinition(AbstractBeanDefinition original)
original - the original bean definition to copy from| Method Detail |
|---|
public void overrideFrom(AbstractBeanDefinition other)
abstract, scope,
lazyInit, autowireMode, dependencyCheck,
and dependsOn from the given bean definition.
constructorArgumentValues, propertyValues,
methodOverrides from the given bean definition to existing ones.
factoryBeanName, factoryMethodName,
initMethodName, and destroyMethodName if specified
in the given bean definition.
public boolean hasBeanClass()
public void setBeanClass(Class beanClass)
public Class getBeanClass() throws IllegalStateException
IllegalStateException - if the bean definition does not define a bean class,
or a specified bean class name has not been resolved into an actual Classpublic void setBeanClassName(String beanClassName)
setBeanClassName in interface BeanDefinitionpublic String getBeanClassName()
getBeanClassName in interface BeanDefinitionpublic Class resolveBeanClass(ClassLoader classLoader) throws ClassNotFoundException
classLoader - the ClassLoader to use for resolving a (potential) class name
ClassNotFoundException - if the class name could be resolvedpublic void setScope(String scope)
Default is "singleton"; the out-of-the-box alternative is "prototype". Extended bean factories might support further scopes.
setScope in interface BeanDefinitionpublic String getScope()
getScope in interface BeanDefinitionpublic void setSingleton(boolean singleton)
"Singletons" are the commoner type, so the default is "true". Note that as of Spring 2.0, this flag is just an alternative way to specify scope="singleton" or scope="prototype".
public boolean isSingleton()
isSingleton in interface BeanDefinitionBeanDefinition.SCOPE_SINGLETONpublic boolean isPrototype()
BeanDefinition.SCOPE_PROTOTYPEpublic void setAbstract(boolean abstractFlag)
Default is "false". Specify true to tell the bean factory to not try to instantiate that particular bean in any case.
public boolean isAbstract()
isAbstract in interface BeanDefinitionpublic void setLazyInit(boolean lazyInit)
If false, the bean will get instantiated on startup by bean
factories that perform eager initialization of singletons.
public boolean isLazyInit()
isLazyInit in interface BeanDefinitionpublic void setAutowireCandidate(boolean autowireCandidate)
public boolean isAutowireCandidate()
public void setAutowireMode(int autowireMode)
autowireMode - the autowire mode to set.
Must be one of the constants defined in this class.AUTOWIRE_NO,
AUTOWIRE_BY_NAME,
AUTOWIRE_BY_TYPE,
AUTOWIRE_CONSTRUCTOR,
AUTOWIRE_AUTODETECTpublic int getAutowireMode()
public int getResolvedAutowireMode()
public void setDependencyCheck(int dependencyCheck)
dependencyCheck - the code to set.
Must be one of the four constants defined in this class.DEPENDENCY_CHECK_NONE,
DEPENDENCY_CHECK_OBJECTS,
DEPENDENCY_CHECK_SIMPLE,
DEPENDENCY_CHECK_ALLpublic int getDependencyCheck()
public void setDependsOn(String[] dependsOn)
Note that dependencies are normally expressed through bean properties or constructor arguments. This property should just be necessary for other kinds of dependencies like statics (*ugh*) or database preparation on startup.
public String[] getDependsOn()
public void setConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues)
public ConstructorArgumentValues getConstructorArgumentValues()
null).
getConstructorArgumentValues in interface BeanDefinitionnull)public boolean hasConstructorArgumentValues()
public void setPropertyValues(MutablePropertyValues propertyValues)
public MutablePropertyValues getPropertyValues()
null).
getPropertyValues in interface BeanDefinitionnull)public void setMethodOverrides(MethodOverrides methodOverrides)
public MethodOverrides getMethodOverrides()
public void setFactoryBeanName(String factoryBeanName)
public String getFactoryBeanName()
public void setFactoryMethodName(String factoryMethodName)
factoryMethodName - static factory method name, or null if
normal constructor creation should be usedgetBeanClass()public String getFactoryMethodName()
public void setInitMethodName(String initMethodName)
null
in which case there is no initializer method.
public String getInitMethodName()
public void setEnforceInitMethod(boolean enforceInitMethod)
false.
setInitMethodName(java.lang.String)public boolean isEnforceInitMethod()
getInitMethodName()public void setDestroyMethodName(String destroyMethodName)
null
in which case there is no destroy method.
public String getDestroyMethodName()
public void setEnforceDestroyMethod(boolean enforceDestroyMethod)
false.
public boolean isEnforceDestroyMethod()
getDestroyMethodName()public void setSynthetic(boolean synthetic)
<aop:config>).
public boolean isSynthetic()
public void setResourceDescription(String resourceDescription)
public String getResourceDescription()
getResourceDescription in interface BeanDefinitionpublic void setSource(Object source)
Object for this metadata element.
The exact type of the object will depend on the configuration mechanism used.
public Object getSource()
BeanMetadataElementObject for this metadata element
(may be null).
getSource in interface BeanMetadataElementpublic void setRole(int role)
BeanDefinition.
public int getRole()
BeanDefinition.
getRole in interface BeanDefinition
public void validate()
throws BeanDefinitionValidationException
BeanDefinitionValidationException - in case of validation failure
public void prepareMethodOverrides()
throws BeanDefinitionValidationException
BeanDefinitionValidationException - in case of validation failureprotected void prepareMethodOverride(MethodOverride mo) throws BeanDefinitionValidationException
mo - the MethodOverride object to validate
BeanDefinitionValidationException - in case of validation failurepublic boolean equals(Object other)
equals in class AttributeAccessorSupportpublic int hashCode()
hashCode in class AttributeAccessorSupportpublic String toString()
|
The Spring Framework | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||