Spring源码解析之BeanDefinition

你。 提交于 2020-12-18 03:32:43
BeanDefinition接口继承了接口AttributeAccessor,BeanMetadataElement。

接口AttributeAccessor:
String[] attributeNames() 
          Return the names of all attributes.
Object getAttribute(String name) 
          Get the value of the attribute identified by name.
boolean hasAttribute(String name) 
          Return true if the attribute identified by name exists.
Object removeAttribute(String name) 
          Remove the attribute identified by name and return its value.
void setAttribute(String name, Object value) 
          Set the attribute defined by name to the supplied value.

 

 接口BeanDefinition:

 BeanDefinition描述了一个bean实例,它具有属性值,构造函数参数值以及具体实现提供的更多信息。这只是一个最小的接口:主要目的是允许BeanFactoryPostProcessor(如PropertyPlaceholderConfigurer)内省和修改属性值和其他bean元数据。  

 

String  getBeanClassName() 
          Return the current bean class name of this bean definition.
ConstructorArgumentValues  getConstructorArgumentValues() 
          Return the constructor argument values for this bean.
String[]  getDependsOn() 
          Return the bean names that this bean depends on.
String  getDescription() 
          Return a human-readable description of this bean definition.
String  getFactoryBeanName() 
          Return the factory bean name, if any.
String  getFactoryMethodName() 
          Return a factory method, if any.
BeanDefinition  getOriginatingBeanDefinition() 
          Return the originating BeanDefinition, or null if none.
String  getParentName() 
          Return the name of the parent definition of this bean definition, if any.
MutablePropertyValues  getPropertyValues() 
          Return the property values to be applied to a new instance of the bean.
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() 
          Get the role hint for this BeanDefinition.
String  getScope() 
          Return the name of the current target scope for this bean, or null if not known yet.
boolean  isAbstract() 
          Return whether this bean is "abstract", that is, not meant to be instantiated.
boolean  isAutowireCandidate() 
          Return whether this bean is a candidate for getting autowired into some other bean.
boolean  isLazyInit() 
          Return whether this bean should be lazily initialized, i.e.
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 on all calls.
void setAutowireCandidate(boolean autowireCandidate) 
          Set whether this bean is a candidate for getting autowired into some other bean.
void  setBeanClassName(String beanClassName) 
          Override the bean class name of this bean definition.
void  setDependsOn(String[] dependsOn) 
          Set the names of the beans that this bean depends on being initialized.
void  setFactoryBeanName(String factoryBeanName) 
          Specify the factory bean to use, if any.
void  setFactoryMethodName(String factoryMethodName) 
          Specify a factory method, if any.
void  setLazyInit(boolean lazyInit) 
          Set whether this bean should be lazily initialized.
void  setParentName(String parentName) 
          Set the name of the parent definition of this bean definition, if any.
void  setPrimary(boolean primary) 
          Set whether this bean is a primary autowire candidate.
void  setScope(String scope) 
          Override the target scope of this bean, specifying a new scope name.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!