public class HashAttributeSet extends Object implements AttributeSet, Serializable
AttributeSet实现具有哈希映射的特性。
| Modifier | Constructor and Description |
|---|---|
|
HashAttributeSet()
构造一个新的空属性集。
|
|
HashAttributeSet(Attribute attribute)
构造一个新的属性集,最初用给定的属性填充。
|
|
HashAttributeSet(Attribute[] attributes)
构造一个新的属性集,最初用给定数组的值填充。
|
protected |
HashAttributeSet(Attribute[] attributes, 类<?> interfaceName)
构造一个新的属性集,其中属性集的成员被限制到给定的接口。
|
protected |
HashAttributeSet(Attribute attribute, 类<?> interfaceName)
构造一个新的属性集,最初用给定的属性填充,属性集的成员被限制到给定的接口。
|
|
HashAttributeSet(AttributeSet attributes)
构造新的属性集,最初用给定集合中的值填充。
|
protected |
HashAttributeSet(AttributeSet attributes, 类<?> interfaceName)
构造一个新的属性集,最初使用给定集合中的值进行填充,其中属性集的成员被限制到给定的接口。
|
protected |
HashAttributeSet(类<?> interfaceName)
构造一个新的空属性集,其中属性集的成员被限制到给定的接口。
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Attribute attribute)
如果指定的属性不存在,请将指定的属性添加到此属性集中,首先删除与指定的属性值相同的属性类别中的任何现有属性。
|
boolean |
addAll(AttributeSet attributes)
将指定集合中的所有元素添加到此属性。
|
void |
clear()
从该属性集中删除所有属性。
|
boolean |
containsKey(类<?> category)
如果此属性集包含指定类别的属性,则返回
true 。
|
boolean |
containsValue(Attribute attribute)
返回
true如果此属性集包含给定的属性。
|
boolean |
equals(Object object)
将指定的对象与此属性集进行比较以便相等。
|
Attribute |
get(类<?> category)
返回此属性集在给定属性类别中包含的属性值。
|
int |
hashCode()
返回此属性集的哈希码值。
|
boolean |
isEmpty()
如果此属性集不包含任何属性,则返回true。
|
boolean |
remove(Attribute attribute)
从该属性集中删除指定的属性(如果存在)。
|
boolean |
remove(类<?> category)
从此属性集中删除此类别的任何属性(如果存在)。
|
int |
size()
返回此属性集中的属性数。
|
Attribute[] |
toArray()
返回此集合中包含的属性的数组。
|
public HashAttributeSet()
public HashAttributeSet(Attribute attribute)
attribute - 添加到集合中的属性值。
NullPointerException - (未选中的异常)如果
attribute为空,则抛出。
public HashAttributeSet(Attribute[] attributes)
attributes数组添加到集合中来填充新的属性集。因此,如果数组包含重复的属性值或属性类别,则稍后的数组元素可以替换较早的数组元素。
attributes - 要添加到集合的属性值的数组。
如果为空,则构造一个空属性集。
NullPointerException - (未选中的异常)如果
attributes任何元素为空,则抛出。
public HashAttributeSet(AttributeSet attributes)
attributes - 从中初始化此集合的属性集。
如果为空,则构造一个空属性集。
protected HashAttributeSet(类<?> interfaceName)
interfaceName - 此属性集的所有成员必须是实例的接口。
假定为接口Attribute或其子接口。
NullPointerException - 如果interfaceName为null。
protected HashAttributeSet(Attribute attribute, 类<?> interfaceName)
attribute - 添加到集合中的属性值。
interfaceName - 该属性集的所有成员必须是实例的接口。
假定为接口Attribute或其子接口。
NullPointerException - (未选中的异常)如果
attribute为空,则抛出。
NullPointerException - 如果interfaceName为null。
ClassCastException - (未经检查的例外)如果
attribute不是
attribute的实例,则
interfaceName 。
protected HashAttributeSet(Attribute[] attributes, 类<?> interfaceName)
attributes数组添加到集合中来填充新的属性集。因此,如果数组包含重复的属性值或属性类别,则稍后的数组元素可以替换较早的数组元素。
attributes - 要添加到集合的属性值数组。
如果为空,则构造一个空属性集。
interfaceName - 此属性集的所有成员必须是实例的接口。
假定为接口Attribute或其子接口。
NullPointerException - (未选中的异常)如果
attributes任何元素为空,则抛出。
NullPointerException - 如果interfaceName为null。
ClassCastException - (未选中的异常)如果attributes的任何元素不是
attributes的实例,则
interfaceName 。
protected HashAttributeSet(AttributeSet attributes, 类<?> interfaceName)
attributes - attributes集合的属性值集。
如果为空,则构造一个空属性集。
interfaceName - 此属性集的所有成员必须是实例的接口。
假定为接口Attribute或其子接口。
ClassCastException - (未经检查的例外)如果attributes的任何元素不是
attributes的实例,则
interfaceName 。
public Attribute get(类<?> category)
get在界面
AttributeSet
category - 要返回其关联属性值的属性类别。
它必须是类实现接口Attribute 。
NullPointerException - (未经检查的异常)如果
category为空,则抛出。
ClassCastException - (未经检查的异常)如果category不是实现接口Attribute的类 ,则抛出异常 。
public boolean add(Attribute attribute)
add在界面
AttributeSet
attribute - 要添加到此属性集的属性值。
NullPointerException - (未选中的异常)如果
attribute为空,则抛出。
UnmodifiableSetException - (未经检查的异常)如果此属性集不支持
add()操作。
public boolean remove(类<?> category)
category为空,那么remove()什么也不做,返回false 。
remove在界面
AttributeSet
category - 要从此属性集中删除的属性类别。
UnmodifiableSetException - (未经检查的异常)如果此属性集不支持
remove()操作。
public boolean remove(Attribute attribute)
attribute为空,那么remove()什么都不做,并返回false 。
remove在界面
AttributeSet
attribute - 要从此属性集中删除的属性值。
UnmodifiableSetException - (未经检查的异常)如果此属性集不支持
remove()操作。
public boolean containsKey(类<?> category)
containsKey在界面
AttributeSet
category - 在此属性集中的存在将被测试。
public boolean containsValue(Attribute attribute)
containsValue在界面
AttributeSet
attribute - 要在此属性集中存在的值要测试。
public boolean addAll(AttributeSet attributes)
add(Attribute)操作已经与指定集合中的每个元素连续应用于此属性集一样。
如果在操作进行中修改了指定的集合,那么addAll(AttributeSet)操作的行为是未指定的。
如果addAll(AttributeSet)操作引发异常,对该属性集的状态的影响是依赖于实现的; 在异常点之前的指定集合中的元素可能已经被添加到该属性集中,也可能不被添加到该属性集中。
addAll在界面
AttributeSet
attributes - 其元素将被添加到此属性集。
UnmodifiableSetException - (未检查异常)如果此属性集不支持
addAll(AttributeSet)方法,则抛出此异常。
NullPointerException - (未检查的异常)如果指定集合中的某些元素为空,则该值为空。
add(Attribute)
public int size()
size在界面
AttributeSet
public Attribute[] toArray()
AttributeSet复制
toArray在界面
AttributeSet
public void clear()
clear在界面
AttributeSet
UnmodifiableSetException - (未经检查的异常)如果此属性集不支持
clear()操作。
public boolean isEmpty()
isEmpty在界面
AttributeSet
public boolean equals(Object object)
equals在界面
AttributeSet
equals在类别
Object
object - 要与此属性集进行相等的比较。
Object.hashCode() , HashMap
public int hashCode()
Object.hashCode() 。
hashCode在界面
AttributeSet
hashCode在
Object
Object.equals(java.lang.Object) ,
System.identityHashCode(java.lang.Object)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.