|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.factory.support.AbstractBeanDefinition
public abstract class AbstractBeanDefinition
Base class for bean definition objects, factoring out common properties of RootBeanDefinition and ChildBeanDefinition.
The autowire constants match the ones defined in the AutowireCapableBeanFactory interface, adding AUTOWIRE_NO.
RootBeanDefinition
,
ChildBeanDefinition
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. |
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 | |
---|---|
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. |
boolean |
hasBeanClass()
Return whether this definition specifies a bean class. |
boolean |
hasConstructorArgumentValues()
Return if there are constructor argument values defined for this bean. |
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 |
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 |
isSingleton()
Return whether this a Singleton, with a single, shared instance returned from all calls. |
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). |
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 |
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 |
setSingleton(boolean singleton)
Set if this a Singleton, with a single, shared instance returned on all calls. |
String |
toString()
|
void |
validate()
Validate this bean definition. |
protected void |
validateMethodOverride(MethodOverride mo)
Validate the given method override. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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 ValuesConstructor Detail |
---|
protected AbstractBeanDefinition()
protected AbstractBeanDefinition(ConstructorArgumentValues cargs, MutablePropertyValues pvs)
protected AbstractBeanDefinition(AbstractBeanDefinition original)
original
- the original bean definition to copy fromMethod Detail |
---|
public void overrideFrom(AbstractBeanDefinition other)
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)
public String getBeanClassName()
public 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 BeanDefinition
public void setSingleton(boolean singleton)
"Singletons" are the commoner type, so the default is "true".
public boolean isSingleton()
isSingleton
in interface BeanDefinition
public 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 BeanDefinition
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_AUTODETECT
public 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_ALL
public 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 BeanDefinition
null
public boolean hasConstructorArgumentValues()
public void setPropertyValues(MutablePropertyValues propertyValues)
public MutablePropertyValues getPropertyValues()
null
).
getPropertyValues
in interface BeanDefinition
null
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 setResourceDescription(String resourceDescription)
public String getResourceDescription()
getResourceDescription
in interface BeanDefinition
public void validate() throws BeanDefinitionValidationException
BeanDefinitionValidationException
- in case of validation failureprotected void validateMethodOverride(MethodOverride mo) throws BeanDefinitionValidationException
mo
- the MethodOverride object to validate
BeanDefinitionValidationException
- in case of validation failurepublic String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |