package org.theonefx.wcframework.ioc;
/**
* Interface defining a generic contract for attaching and accessing metadata to/from arbitrary objects.
*/
public interface AttributeAccessor {
/**
* 设置一个<code>name</code> --> <code>value</code>的attribute
* 如果<code>value</code>为<code>null</code>,那么这个attribute将被删除{@link #removeAttribute removed}.
* <p>在一般情况下,用户应该小心避免与其他元数据属性重叠使用完全限定名称,也许使用类或包名作为前缀
* @param name attribute的唯一键名
* @param value 需要被设置的attribute的值
*/
void setAttribute(String name, Object value);
/**
* 获取名称为<code>name</code>的attribute的value.
* 如果找不到该name对应的attribute则返回<code>null</code>.
* @param name 属性名称
* @return 如果有的话则返回最后的值,否则返回null
*/
Object getAttribute(String name);
/**
* 删除名称为 <code>name</code> 的attribute并返回他的value.
* 如果找不到该name对应的attribute则返回<code>null</code>.
* @param name 属性名称
* @return 如果有的话则返回最后的值,否则返回null
*/
Object removeAttribute(String name);
/**
* 如果返回 <code>true</code> 则代表名称为<code>name</code>的属性存在.
* 否则返回 <code>false</code>.
*/
boolean hasAttribute(String name);
/**
* 返回所有属性的名称
*/
String[] attributeNames();
}