org.springframework.beans.factory.support
Class AbstractBeanDefinition

java.lang.Object
  extended by org.springframework.core.AttributeAccessorSupport
      extended by org.springframework.beans.BeanMetadataAttributeAccessor
          extended by org.springframework.beans.factory.support.AbstractBeanDefinition
All Implemented Interfaces:
Serializable, Cloneable, BeanMetadataElement, BeanDefinition, AttributeAccessor
Direct Known Subclasses:
ChildBeanDefinition, GenericBeanDefinition, RootBeanDefinition

public abstract class AbstractBeanDefinition
extends BeanMetadataAttributeAccessor
implements BeanDefinition, Cloneable

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.

Author:
Rod Johnson, Juergen Hoeller, Rob Harrop, Mark Fisher
See Also:
RootBeanDefinition, ChildBeanDefinition, Serialized Form

Field Summary
static int AUTOWIRE_AUTODETECT
          Deprecated. as of Spring 3.0: If you are using mixed autowiring strategies, use annotation-based autowiring for clearer demarcation of autowiring needs.
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.
static String SCOPE_DEFAULT
          Constant for the default scope name: "", equivalent to singleton status but to be overridden from a parent bean definition (if applicable).
 
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)
          Deprecated. since Spring 2.5, in favor of AbstractBeanDefinition(BeanDefinition)
protected AbstractBeanDefinition(BeanDefinition 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
 void addQualifier(AutowireCandidateQualifier qualifier)
          Register a qualifier to be used for autowire candidate resolution, keyed by the qualifier's type name.
 void applyDefaults(BeanDefinitionDefaults defaults)
          Apply the provided default values to this bean.
 Object clone()
          Public declaration of Object's clone() method.
abstract  AbstractBeanDefinition cloneBeanDefinition()
          Clone this bean definition.
 void copyQualifiersFrom(AbstractBeanDefinition source)
          Copy the qualifiers from the supplied AbstractBeanDefinition to this bean definition.
 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, if already resolved.
 String getBeanClassName()
          Return the current bean class name of this bean definition.
 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 getDescription()
          Return a human-readable description of this bean definition.
 String getDestroyMethodName()
          Return the name of the destroy method.
 String getFactoryBeanName()
          Return 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.
 BeanDefinition getOriginatingBeanDefinition()
          Return the originating BeanDefinition, or null if none.
 MutablePropertyValues getPropertyValues()
          Return property values for this bean (never null).
 AutowireCandidateQualifier getQualifier(String typeName)
          Return the qualifier mapped to the provided type name.
 Set<AutowireCandidateQualifier> getQualifiers()
          Return all registered qualifiers.
 int getResolvedAutowireMode()
          Return the resolved autowire code, (resolving AUTOWIRE_AUTODETECT to AUTOWIRE_CONSTRUCTOR or AUTOWIRE_BY_TYPE).
 Resource getResource()
          Return the resource that this bean definition came from.
 String getResourceDescription()
          Return a description of the resource that this bean definition came from (for the purpose of showing context in case of errors).
 int getRole()
          Return the role hint for this BeanDefinition.
 String getScope()
          Return the name of the target scope for the bean.
 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 hasQualifier(String typeName)
          Return whether this bean has the specified qualifier.
 boolean isAbstract()
          Return whether this bean is "abstract", i.e.
 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.
 boolean isLenientConstructorResolution()
          Return whether to resolve constructors in lenient mode or in strict mode.
 boolean isNonPublicAccessAllowed()
          Return whether to allow access to non-public constructors and methods.
 boolean isPrimary()
          Return whether this bean is a primary autowire candidate.
 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)
          Deprecated. since Spring 2.5, in favor of overrideFrom(BeanDefinition)
 void overrideFrom(BeanDefinition 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.
 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)
          Override the bean class name of this bean definition.
 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 setDescription(String description)
          Set a human-readable description of this bean definition.
 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 setLenientConstructorResolution(boolean lenientConstructorResolution)
          Specify whether to resolve constructors in lenient mode (true, which is the default) or to switch to strict resolution (throwing an exception in case of ambigious constructors that all match when converting the arguments, whereas lenient mode would use the one with the 'closest' type matches).
 void setMethodOverrides(MethodOverrides methodOverrides)
          Specify method overrides for the bean, if any.
 void setNonPublicAccessAllowed(boolean nonPublicAccessAllowed)
          Specify whether to allow access to non-public constructors and methods, for the case of externalized metadata pointing to those.
 void setOriginatingBeanDefinition(BeanDefinition originatingBd)
          Set the originating (e.g.
 void setPrimary(boolean primary)
          Set whether this bean is a primary autowire candidate.
 void setPropertyValues(MutablePropertyValues propertyValues)
          Specify property values for this bean, if any.
 void setResource(Resource resource)
          Set the resource that this bean definition came from (for the purpose of showing context in case of errors).
 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)
          Deprecated. since Spring 2.5, in favor of setScope(java.lang.String)
 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.beans.BeanMetadataAttributeAccessor
addMetadataAttribute, getAttribute, getMetadataAttribute, getSource, removeAttribute, setAttribute, setSource
 
Methods inherited from class org.springframework.core.AttributeAccessorSupport
attributeNames, copyAttributesFrom, hasAttribute
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.beans.factory.config.BeanDefinition
getParentName, setParentName
 
Methods inherited from interface org.springframework.core.AttributeAccessor
attributeNames, getAttribute, hasAttribute, removeAttribute, setAttribute
 
Methods inherited from interface org.springframework.beans.BeanMetadataElement
getSource
 

Field Detail

SCOPE_DEFAULT

public static final String SCOPE_DEFAULT
Constant for the default scope name: "", equivalent to singleton status but to be overridden from a parent bean definition (if applicable).

See Also:
Constant Field Values

AUTOWIRE_NO

public static final int AUTOWIRE_NO
Constant that indicates no autowiring at all.

See Also:
setAutowireMode(int), Constant Field Values

AUTOWIRE_BY_NAME

public static final int AUTOWIRE_BY_NAME
Constant that indicates autowiring bean properties by name.

See Also:
setAutowireMode(int), Constant Field Values

AUTOWIRE_BY_TYPE

public static final int AUTOWIRE_BY_TYPE
Constant that indicates autowiring bean properties by type.

See Also:
setAutowireMode(int), Constant Field Values

AUTOWIRE_CONSTRUCTOR

public static final int AUTOWIRE_CONSTRUCTOR
Constant that indicates autowiring a constructor.

See Also:
setAutowireMode(int), Constant Field Values

AUTOWIRE_AUTODETECT

@Deprecated
public static final int AUTOWIRE_AUTODETECT
Deprecated. as of Spring 3.0: If you are using mixed autowiring strategies, use annotation-based autowiring for clearer demarcation of autowiring needs.
Constant that indicates determining an appropriate autowire strategy through introspection of the bean class.

See Also:
setAutowireMode(int), Constant Field Values

DEPENDENCY_CHECK_NONE

public static final int DEPENDENCY_CHECK_NONE
Constant that indicates no dependency check at all.

See Also:
setDependencyCheck(int), Constant Field Values

DEPENDENCY_CHECK_OBJECTS

public static final int DEPENDENCY_CHECK_OBJECTS
Constant that indicates dependency checking for object references.

See Also:
setDependencyCheck(int), Constant Field Values

DEPENDENCY_CHECK_SIMPLE

public static final int DEPENDENCY_CHECK_SIMPLE
Constant that indicates dependency checking for "simple" properties.

See Also:
setDependencyCheck(int), BeanUtils.isSimpleProperty(java.lang.Class), Constant Field Values

DEPENDENCY_CHECK_ALL

public static final int DEPENDENCY_CHECK_ALL
Constant that indicates dependency checking for all properties (object references as well as "simple" properties).

See Also:
setDependencyCheck(int), Constant Field Values
Constructor Detail

AbstractBeanDefinition

protected AbstractBeanDefinition()
Create a new AbstractBeanDefinition with default settings.


AbstractBeanDefinition

protected AbstractBeanDefinition(ConstructorArgumentValues cargs,
                                 MutablePropertyValues pvs)
Create a new AbstractBeanDefinition with the given constructor argument values and property values.


AbstractBeanDefinition

@Deprecated
protected AbstractBeanDefinition(AbstractBeanDefinition original)
Deprecated. since Spring 2.5, in favor of AbstractBeanDefinition(BeanDefinition)

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

Parameters:
original - the original bean definition to copy from

AbstractBeanDefinition

protected AbstractBeanDefinition(BeanDefinition original)
Create a new AbstractBeanDefinition as deep copy of the given bean definition.

Parameters:
original - the original bean definition to copy from
Method Detail

overrideFrom

@Deprecated
public void overrideFrom(AbstractBeanDefinition other)
Deprecated. since Spring 2.5, in favor of overrideFrom(BeanDefinition)

Override settings in this bean definition (assumably a copied parent from a parent-child inheritance relationship) from the given bean definition (assumably the child).


overrideFrom

public void overrideFrom(BeanDefinition 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).


applyDefaults

public void applyDefaults(BeanDefinitionDefaults defaults)
Apply the provided default values to this bean.

Parameters:
defaults - the defaults to apply

hasBeanClass

public boolean hasBeanClass()
Return whether this definition specifies a bean class.


setBeanClass

public void setBeanClass(Class<?> beanClass)
Specify the class for this bean.


getBeanClass

public Class<?> getBeanClass()
                      throws IllegalStateException
Return the class of the wrapped bean, if already resolved.

Returns:
the bean class, or null if none defined
Throws:
IllegalStateException - if the bean definition does not define a bean class, or a specified bean class name has not been resolved into an actual Class

setBeanClassName

public void setBeanClassName(String beanClassName)
Description copied from interface: BeanDefinition
Override the bean class name of this bean definition.

The class name can be modified during bean factory post-processing, typically replacing the original class name with a parsed variant of it.

Specified by:
setBeanClassName in interface BeanDefinition

getBeanClassName

public String getBeanClassName()
Description copied from interface: BeanDefinition
Return the current bean class name of this bean definition.

Note that this does not have to be the actual class name used at runtime, in case of a child definition overriding/inheriting the class name from its parent. Hence, do not consider this to be the definitive bean type at runtime but rather only use it for parsing purposes at the individual bean definition level.

Specified by:
getBeanClassName in interface BeanDefinition

resolveBeanClass

public Class resolveBeanClass(ClassLoader classLoader)
                       throws ClassNotFoundException
Determine the class of the wrapped bean, resolving it from a specified class name if necessary. Will also reload a specified Class from its name when called with the bean class already resolved.

Parameters:
classLoader - the ClassLoader to use for resolving a (potential) class name
Returns:
the resolved bean class
Throws:
ClassNotFoundException - if the class name could be resolved

setScope

public void setScope(String scope)
Set the name of the target scope for the bean.

Default is singleton status, although this is only applied once a bean definition becomes active in the containing factory. A bean definition may eventually inherit its scope from a parent bean definitionFor this reason, the default scope name is empty (empty String), with singleton status being assumed until a resolved scope will be set.

Specified by:
setScope in interface BeanDefinition
See Also:
BeanDefinition.SCOPE_SINGLETON, BeanDefinition.SCOPE_PROTOTYPE

getScope

public String getScope()
Return the name of the target scope for the bean.

Specified by:
getScope in interface BeanDefinition

setSingleton

@Deprecated
public void setSingleton(boolean singleton)
Deprecated. since Spring 2.5, in favor of setScope(java.lang.String)

Set if this a Singleton, with a single, shared instance returned on all calls. In case of "false", the BeanFactory will apply the Prototype design pattern, with each caller requesting an instance getting an independent instance. How this is exactly defined will depend on the BeanFactory.

"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".

See Also:
setScope(java.lang.String), BeanDefinition.SCOPE_SINGLETON, BeanDefinition.SCOPE_PROTOTYPE

isSingleton

public boolean isSingleton()
Return whether this a Singleton, with a single shared instance returned from all calls.

Specified by:
isSingleton in interface BeanDefinition
See Also:
BeanDefinition.SCOPE_SINGLETON

isPrototype

public boolean isPrototype()
Return whether this a Prototype, with an independent instance returned for each call.

Specified by:
isPrototype in interface BeanDefinition
See Also:
BeanDefinition.SCOPE_PROTOTYPE

setAbstract

public 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.

Default is "false". Specify true to tell the bean factory to not try to instantiate that particular bean in any case.


isAbstract

public 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.

Specified by:
isAbstract in interface BeanDefinition

setLazyInit

public void setLazyInit(boolean lazyInit)
Set whether this bean should be lazily initialized.

If false, the bean will get instantiated on startup by bean factories that perform eager initialization of singletons.

Specified by:
setLazyInit in interface BeanDefinition

isLazyInit

public boolean isLazyInit()
Return whether this bean should be lazily initialized, i.e. not eagerly instantiated on startup. Only applicable to a singleton bean.

Specified by:
isLazyInit in interface BeanDefinition

setAutowireMode

public void setAutowireMode(int autowireMode)
Set the autowire mode. This determines whether any automagical detection and setting of bean references will happen. Default is AUTOWIRE_NO, which means there's no autowire.

Parameters:
autowireMode - the autowire mode to set. Must be one of the constants defined in this class.
See Also:
AUTOWIRE_NO, AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_CONSTRUCTOR, AUTOWIRE_AUTODETECT

getAutowireMode

public int getAutowireMode()
Return the autowire mode as specified in the bean definition.


getResolvedAutowireMode

public int getResolvedAutowireMode()
Return the resolved autowire code, (resolving AUTOWIRE_AUTODETECT to AUTOWIRE_CONSTRUCTOR or AUTOWIRE_BY_TYPE).

See Also:
AUTOWIRE_AUTODETECT, AUTOWIRE_CONSTRUCTOR, AUTOWIRE_BY_TYPE

setDependencyCheck

public void setDependencyCheck(int dependencyCheck)
Set the dependency check code.

Parameters:
dependencyCheck - the code to set. Must be one of the four constants defined in this class.
See Also:
DEPENDENCY_CHECK_NONE, DEPENDENCY_CHECK_OBJECTS, DEPENDENCY_CHECK_SIMPLE, DEPENDENCY_CHECK_ALL

getDependencyCheck

public int getDependencyCheck()
Return the dependency check code.


setDependsOn

public void setDependsOn(String[] dependsOn)
Set the names of the beans that this bean depends on being initialized. The bean factory will guarantee that these beans get initialized first.

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.

Specified by:
setDependsOn in interface BeanDefinition

getDependsOn

public String[] getDependsOn()
Return the bean names that this bean depends on.

Specified by:
getDependsOn in interface BeanDefinition

setAutowireCandidate

public void setAutowireCandidate(boolean autowireCandidate)
Set whether this bean is a candidate for getting autowired into some other bean.

Specified by:
setAutowireCandidate in interface BeanDefinition

isAutowireCandidate

public boolean isAutowireCandidate()
Return whether this bean is a candidate for getting autowired into some other bean.

Specified by:
isAutowireCandidate in interface BeanDefinition

setPrimary

public void setPrimary(boolean primary)
Set whether this bean is a primary autowire candidate. If this value is true for exactly one bean among multiple matching candidates, it will serve as a tie-breaker.

Specified by:
setPrimary in interface BeanDefinition

isPrimary

public boolean isPrimary()
Return whether this bean is a primary autowire candidate. If this value is true for exactly one bean among multiple matching candidates, it will serve as a tie-breaker.

Specified by:
isPrimary in interface BeanDefinition

addQualifier

public void addQualifier(AutowireCandidateQualifier qualifier)
Register a qualifier to be used for autowire candidate resolution, keyed by the qualifier's type name.

See Also:
AutowireCandidateQualifier.getTypeName()

hasQualifier

public boolean hasQualifier(String typeName)
Return whether this bean has the specified qualifier.


getQualifier

public AutowireCandidateQualifier getQualifier(String typeName)
Return the qualifier mapped to the provided type name.


getQualifiers

public Set<AutowireCandidateQualifier> getQualifiers()
Return all registered qualifiers.

Returns:
the Set of AutowireCandidateQualifier objects.

copyQualifiersFrom

public void copyQualifiersFrom(AbstractBeanDefinition source)
Copy the qualifiers from the supplied AbstractBeanDefinition to this bean definition.

Parameters:
source - the AbstractBeanDefinition to copy from

setNonPublicAccessAllowed

public void setNonPublicAccessAllowed(boolean nonPublicAccessAllowed)
Specify whether to allow access to non-public constructors and methods, for the case of externalized metadata pointing to those.

This applies to constructor resolution, factory method resolution, and also init/destroy methods. Bean property accessors have to be public in any case and are not affected by this setting.

Note that annotation-driven configuration will still access non-public members as far as they have been annotated. This setting applies to externalized metadata in this bean definition only.


isNonPublicAccessAllowed

public boolean isNonPublicAccessAllowed()
Return whether to allow access to non-public constructors and methods.


setLenientConstructorResolution

public void setLenientConstructorResolution(boolean lenientConstructorResolution)
Specify whether to resolve constructors in lenient mode (true, which is the default) or to switch to strict resolution (throwing an exception in case of ambigious constructors that all match when converting the arguments, whereas lenient mode would use the one with the 'closest' type matches).


isLenientConstructorResolution

public boolean isLenientConstructorResolution()
Return whether to resolve constructors in lenient mode or in strict mode.


setConstructorArgumentValues

public void setConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues)
Specify constructor argument values for this bean.


getConstructorArgumentValues

public ConstructorArgumentValues getConstructorArgumentValues()
Return constructor argument values for this bean (never null).

Specified by:
getConstructorArgumentValues in interface BeanDefinition
Returns:
the ConstructorArgumentValues object (never null)

hasConstructorArgumentValues

public boolean hasConstructorArgumentValues()
Return if there are constructor argument values defined for this bean.


setPropertyValues

public void setPropertyValues(MutablePropertyValues propertyValues)
Specify property values for this bean, if any.


getPropertyValues

public MutablePropertyValues getPropertyValues()
Return property values for this bean (never null).

Specified by:
getPropertyValues in interface BeanDefinition
Returns:
the MutablePropertyValues object (never null)

setMethodOverrides

public void setMethodOverrides(MethodOverrides methodOverrides)
Specify method overrides for the bean, if any.


getMethodOverrides

public MethodOverrides getMethodOverrides()
Return information about methods to be overridden by the IoC container. This will be empty if there are no method overrides. Never returns null.


setFactoryBeanName

public void setFactoryBeanName(String factoryBeanName)
Description copied from interface: BeanDefinition
Specify the factory bean to use, if any.

Specified by:
setFactoryBeanName in interface BeanDefinition

getFactoryBeanName

public String getFactoryBeanName()
Description copied from interface: BeanDefinition
Return the factory bean name, if any.

Specified by:
getFactoryBeanName in interface BeanDefinition

setFactoryMethodName

public void setFactoryMethodName(String factoryMethodName)
Description copied from interface: BeanDefinition
Specify a factory method, if any. This method will be invoked with constructor arguments, or with no arguments if none are specified. The method will be invoked on the specifed factory bean, if any, or as static method on the local bean class else.

Specified by:
setFactoryMethodName in interface BeanDefinition
Parameters:
factoryMethodName - static factory method name, or null if normal constructor creation should be used
See Also:
BeanDefinition.getBeanClassName()

getFactoryMethodName

public String getFactoryMethodName()
Description copied from interface: BeanDefinition
Return a factory method, if any.

Specified by:
getFactoryMethodName in interface BeanDefinition

setInitMethodName

public void setInitMethodName(String initMethodName)
Set the name of the initializer method. The default is null in which case there is no initializer method.


getInitMethodName

public String getInitMethodName()
Return the name of the initializer method.


setEnforceInitMethod

public void setEnforceInitMethod(boolean enforceInitMethod)
Specify whether or not the configured init method is the default. Default value is false.

See Also:
setInitMethodName(java.lang.String)

isEnforceInitMethod

public boolean isEnforceInitMethod()
Indicate whether the configured init method is the default.

See Also:
getInitMethodName()

setDestroyMethodName

public void setDestroyMethodName(String destroyMethodName)
Set the name of the destroy method. The default is null in which case there is no destroy method.


getDestroyMethodName

public String getDestroyMethodName()
Return the name of the destroy method.


setEnforceDestroyMethod

public void setEnforceDestroyMethod(boolean enforceDestroyMethod)
Specify whether or not the configured destroy method is the default. Default value is false.

See Also:
setDestroyMethodName(java.lang.String)

isEnforceDestroyMethod

public boolean isEnforceDestroyMethod()
Indicate whether the configured destroy method is the default.

See Also:
getDestroyMethodName()

setSynthetic

public 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>).


isSynthetic

public boolean isSynthetic()
Return whether this bean definition is 'synthetic', that is, not defined by the application itself.


setRole

public void setRole(int role)
Set the role hint for this BeanDefinition.


getRole

public int getRole()
Return the role hint for this BeanDefinition.

Specified by:
getRole in interface BeanDefinition
See Also:
BeanDefinition.ROLE_APPLICATION, BeanDefinition.ROLE_INFRASTRUCTURE, BeanDefinition.ROLE_SUPPORT

setDescription

public void setDescription(String description)
Set a human-readable description of this bean definition.


getDescription

public String getDescription()
Description copied from interface: BeanDefinition
Return a human-readable description of this bean definition.

Specified by:
getDescription in interface BeanDefinition

setResource

public void setResource(Resource resource)
Set the resource that this bean definition came from (for the purpose of showing context in case of errors).


getResource

public Resource getResource()
Return the resource that this bean definition came from.


setResourceDescription

public 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).


getResourceDescription

public String getResourceDescription()
Description copied from interface: BeanDefinition
Return a description of the resource that this bean definition came from (for the purpose of showing context in case of errors).

Specified by:
getResourceDescription in interface BeanDefinition

setOriginatingBeanDefinition

public void setOriginatingBeanDefinition(BeanDefinition originatingBd)
Set the originating (e.g. decorated) BeanDefinition, if any.


getOriginatingBeanDefinition

public BeanDefinition getOriginatingBeanDefinition()
Description copied from interface: BeanDefinition
Return the originating BeanDefinition, or null if none. Allows for retrieving the decorated bean definition, if any.

Note that this method returns the immediate originator. Iterate through the originator chain to find the original BeanDefinition as defined by the user.

Specified by:
getOriginatingBeanDefinition in interface BeanDefinition

validate

public void validate()
              throws BeanDefinitionValidationException
Validate this bean definition.

Throws:
BeanDefinitionValidationException - in case of validation failure

prepareMethodOverrides

public void prepareMethodOverrides()
                            throws BeanDefinitionValidationException
Validate and prepare the method overrides defined for this bean. Checks for existence of a method with the specified name.

Throws:
BeanDefinitionValidationException - in case of validation failure

prepareMethodOverride

protected void prepareMethodOverride(MethodOverride mo)
                              throws BeanDefinitionValidationException
Validate and prepare the given method override. Checks for existence of a method with the specified name, marking it as not overloaded if none found.

Parameters:
mo - the MethodOverride object to validate
Throws:
BeanDefinitionValidationException - in case of validation failure

clone

public Object clone()
Public declaration of Object's clone() method. Delegates to cloneBeanDefinition().

Overrides:
clone in class Object
See Also:
Object.clone()

cloneBeanDefinition

public abstract AbstractBeanDefinition cloneBeanDefinition()
Clone this bean definition. To be implemented by concrete subclasses.

Returns:
the cloned bean definition object

equals

public boolean equals(Object other)
Overrides:
equals in class AttributeAccessorSupport

hashCode

public int hashCode()
Overrides:
hashCode in class AttributeAccessorSupport

toString

public String toString()
Overrides:
toString in class Object