RootBeanDefinition 继承关系图
AttributeAccessor 接口作用:定义用于附加和访问元数据的通用接口
//设置属性值
void setAttribute(String name, @Nullable Object value);
//获取指定属性名称的值,如果不存在返回null
Object getAttribute(String name);
//删除指定的name的属性,如果不存在返回null
@Nullable
Object removeAttribute(String name);
//判断指定的属性名称是否存在,属性名称必须是唯一
boolean hasAttribute(String name);
//获得所有属性的名称
String[] attributeNames();
AttributeAccessorSupport抽象类作用:实现AttributeAccessor
Serializable序列化接口,内部使用LinkedHashMap key=name,value=value作为容器装载attribute属性。
方法
setAttribute name不允许为空,若value!=null,putkv;否则视为根据name removeAttribute
getAttribute LinkedHashMap的get方法根据name获取value
removeAttribute LinkedHashMap的remove方法根据name删除value,返回旧value
hasAttribute LinkedHashMap的containsKey方法 判断是否包含name
attributeNames this.attributes.keySet().toArray(new String[this.attributes.size()]);通过keySet 转换 String[] name数组
copyAttributesFrom source for循环入参AttributeAccessor的attributeNames方法拷贝属性到当前对象
重写equals方法 先通过 == 判断对象是否是同一个,再通过instanceof 判断是否AttributeAccessorSupport 类型,如果是强转判断目标attributes与当前attributes属性equals方法是否相等
hashCode方法,返回attributes的hashCode
BeanMetadataElement:带有配置源对象的bean元数据元素实现接口
方法 Object getSource() 获取当前元素的配置源bean对象
BeanMetadataAttributeAccessor:AbstractBeanDefinition提供了接口 AttributeAccessor定义的属性访问能力以及BeanMetadataElement定义的源配置对象设置和获取能力。