模块 java.desktop

类 HashAttributeSet

java.lang.Object
javax.print.attribute.HashAttributeSet
所有已实现的接口:
Serializable , AttributeSet
已知子类:
HashDocAttributeSet , HashPrintJobAttributeSet , HashPrintRequestAttributeSet , HashPrintServiceAttributeSet

public class HashAttributeSet extends Object implements AttributeSet , Serializable
HashAttributeSet 提供具有hash map特征的 AttributeSet 实现。
参见:
  • 构造方法总结

    构造方法
    修饰符
    构造方法
    描述
     
    构造一个新的空属性集。
    protected
    HashAttributeSet(Class<?> interfaceName)
    构造一个新的空属性集,其中属性集的成员仅限于给定的接口。
     
    构造一个新的属性集,最初用给定的属性填充。
     
    HashAttributeSet(Attribute[] attributes)
    构造一个新的属性集,最初使用给定数组中的值填充。
    protected
    HashAttributeSet(Attribute[] attributes, Class<?> interfaceName)
    构造一个新的属性集,其中属性集的成员仅限于给定的接口。
    protected
    HashAttributeSet(Attribute attribute, Class<?> interfaceName)
    构造一个新的属性集,最初使用给定的属性填充,其中属性集的成员仅限于给定的接口。
     
    构造一个新的属性集,最初使用给定集中的值填充。
    protected
    HashAttributeSet(AttributeSet attributes, Class<?> interfaceName)
    构造一个新的属性集,最初使用给定集中的值填充,其中属性集的成员仅限于给定的接口。
  • 方法总结

    修饰符和类型
    方法
    描述
    boolean
    add(Attribute attribute)
    如果指定的属性尚不存在,则将指定的属性添加到此属性集中,首先删除与指定的属性值相同的属性类别中的任何现有属性。
    boolean
    addAll(AttributeSet attributes)
    将指定集中的所有元素添加到此属性。
    void
    从此属性集中删除所有属性。
    boolean
    containsKey(Class<?> category)
    如果此属性集包含指定类别的属性,则返回 true
    boolean
    如果此属性集包含给定属性,则返回 true
    boolean
    equals(Object object)
    比较指定对象与此属性集的相等性。
    get(Class<?> category)
    返回此属性集包含在给定属性类别中的属性值。
    int
    返回此属性集的散列码值。
    boolean
    如果此属性集不包含任何属性,则返回 true
    boolean
    remove(Class<?> category)
    从此属性集中移除此类别的任何属性(如果存在)。
    boolean
    remove(Attribute attribute)
    从此属性集中移除指定的属性(如果存在)。
    int
    size()
    返回此属性集中的属性数。
    返回此集合中包含的属性数组。

    在类 java.lang.Object 中声明的方法

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • 构造方法详细信息

    • HashAttributeSet

      public HashAttributeSet()
      构造一个新的空属性集。
    • HashAttributeSet

      public HashAttributeSet(Attribute  attribute)
      构造一个新的属性集,最初用给定的属性填充。
      参数:
      attribute - 要添加到集合中的属性值
      抛出:
      NullPointerException - 如果 attributenull
    • HashAttributeSet

      public HashAttributeSet(Attribute [] attributes)
      构造一个新的属性集,最初使用给定数组中的值填充。通过从索引 0 开始按顺序将 attributes 数组的元素添加到集合中来填充新属性集。因此,如果数组包含重复的属性值或属性类别,则后面的数组元素可能会替换前面的数组元素。
      参数:
      attributes - 要添加到集合中的属性值数组。如果为 null ,则构造一个空属性集。
      抛出:
      NullPointerException - 如果 attributes 的任何元素是 null
    • HashAttributeSet

      public HashAttributeSet(AttributeSet  attributes)
      构造一个新的属性集,最初使用给定集中的值填充。
      参数:
      attributes - 从中初始化此集合的属性集。如果为 null ,则构造一个空属性集。
    • HashAttributeSet

      protected HashAttributeSet(Class <?> interfaceName)
      构造一个新的空属性集,其中属性集的成员仅限于给定的接口。
      参数:
      interfaceName - 该属性集的所有成员都必须是其实例的接口。假定为接口 Attribute 或其子接口。
      抛出:
      NullPointerException - 如果 interfaceNamenull
    • HashAttributeSet

      protected HashAttributeSet(Attribute  attribute, Class <?> interfaceName)
      构造一个新的属性集,最初使用给定的属性填充,其中属性集的成员仅限于给定的接口。
      参数:
      attribute - 要添加到集合中的属性值
      interfaceName - 该属性集的所有成员都必须是其实例的接口。假定为接口 Attribute 或其子接口。
      抛出:
      NullPointerException - 如果 attributeinterfaceNamenull
      ClassCastException - 如果 attribute 不是 interfaceName 的实例
    • HashAttributeSet

      protected HashAttributeSet(Attribute [] attributes, Class <?> interfaceName)
      构造一个新的属性集,其中属性集的成员仅限于给定的接口。通过从索引 0 开始按顺序将 attributes 数组的元素添加到集合中来填充新属性集。因此,如果数组包含重复的属性值或属性类别,则后面的数组元素可能会替换前面的数组元素。
      参数:
      attributes - 要添加到集合中的属性值数组。如果为 null ,则构造一个空属性集。
      interfaceName - 该属性集的所有成员都必须是其实例的接口。假定为接口 Attribute 或其子接口。
      抛出:
      NullPointerException - 如果 interfaceNamenull,或者如果 attributes 的任何元素是 null
      ClassCastException - 如果 attributes 的任何元素不是 interfaceName 的实例
    • HashAttributeSet

      protected HashAttributeSet(AttributeSet  attributes, Class <?> interfaceName)
      构造一个新的属性集,最初使用给定集中的值填充,其中属性集的成员仅限于给定的接口。
      参数:
      attributes - 用于初始化集合的属性值集合。如果为 null ,则构造一个空属性集。
      interfaceName - 该属性集的所有成员都必须是一个实例的接口。假定为接口 Attribute 或其子接口。
      抛出:
      ClassCastException - 如果 attributes 的任何元素不是 interfaceName 的实例
  • 方法详情

    • get

      public Attribute  get(Class <?> category)
      返回此属性集包含在给定属性类别中的属性值。如果此属性集不包含给定属性类别中的任何属性值,则返回 null
      指定者:
      get 在接口 AttributeSet
      参数:
      category - 要返回其关联属性值的属性类别。它必须是实现接口 Attribute Class
      返回:
      此属性集中包含的给定属性类别中的属性值,或者 null 如果此属性集不包含给定属性类别中的任何属性值
      抛出:
      NullPointerException - 如果 categorynull
      ClassCastException - 如果 category 不是实现接口 Attribute Class
    • add

      public boolean add(Attribute  attribute)
      如果指定的属性尚不存在,则将指定的属性添加到此属性集中,首先删除与指定的属性值相同的属性类别中的任何现有属性。
      指定者:
      add 在接口 AttributeSet
      参数:
      attribute - 要添加到此属性集中的属性值
      返回:
      true 如果此属性集因调用而更改,即给定的属性值还不是此属性集的成员
      抛出:
      NullPointerException - 如果 attributenull
      UnmodifiableSetException - 如果此属性集不支持 add() 操作
    • remove

      public boolean remove(Class <?> category)
      从此属性集中移除此类别的任何属性(如果存在)。如果 categorynull,则 remove() 什么都不做并返回 false
      指定者:
      remove 在接口 AttributeSet
      参数:
      category - 要从此属性集中删除的属性类别
      返回:
      true 如果此属性集因调用而更改,即给定的属性类别已成为此属性集的成员
      抛出:
      UnmodifiableSetException - 如果此属性集不支持 remove() 操作
    • remove

      public boolean remove(Attribute  attribute)
      从此属性集中移除指定的属性(如果存在)。如果 attributenull,则 remove() 什么都不做并返回 false
      指定者:
      remove 在接口 AttributeSet
      参数:
      attribute - 要从此属性集中删除的属性值
      返回:
      true 如果此属性集因调用而更改,即给定的属性值已成为此属性集的成员
      抛出:
      UnmodifiableSetException - 如果此属性集不支持 remove() 操作
    • containsKey

      public boolean containsKey(Class <?> category)
      如果此属性集包含指定类别的属性,则返回 true
      指定者:
      containsKey 在接口 AttributeSet
      参数:
      category - 要测试其在此属性集中的存在
      返回:
      true 如果此属性集包含指定类别的属性值
    • containsValue

      public boolean containsValue(Attribute  attribute)
      如果此属性集包含给定属性,则返回 true
      指定者:
      containsValue 在接口 AttributeSet
      参数:
      attribute - 要测试其在此属性集中是否存在的值
      返回:
      true 如果此属性集包含给定的属性值
    • addAll

      public boolean addAll(AttributeSet  attributes)
      将指定集中的所有元素添加到此属性。结果与 add(Attribute) 操作已连续应用到此属性集与指定集中的每个元素相同。 addAll(AttributeSet) 操作的行为是未指定的,如果指定的集合在操作过程中被修改。

      如果 addAll(AttributeSet) 操作抛出异常,则对该属性集状态的影响取决于实现;异常点之前指定集中的元素可能已添加到此属性集中,也可能未添加到此属性集中。

      指定者:
      addAll 在接口 AttributeSet
      参数:
      attributes - 要将其元素添加到此属性集中
      返回:
      true 如果此属性集因调用而更改
      抛出:
      UnmodifiableSetException - 如果此属性集不支持 addAll(AttributeSet) 方法
      NullPointerException - 如果指定集合中的某个元素是 null ,或者集合是 null
      参见:
    • size

      public int size()
      返回此属性集中的属性数。如果此属性集包含超过 Integer.MAX_VALUE 个元素,则返回 Integer.MAX_VALUE
      指定者:
      size 在接口 AttributeSet
      返回:
      此属性集中的属性数
    • toArray

      public Attribute [] toArray()
      返回此集合中包含的属性数组。
      指定者:
      toArray 在接口 AttributeSet
      返回:
      此集合中包含的属性作为数组,如果 AttributeSet 为空,则长度为零
    • clear

      public void clear()
      从此属性集中删除所有属性。
      指定者:
      clear 在接口 AttributeSet
      抛出:
      UnmodifiableSetException - 如果此属性集不支持 clear() 操作
    • isEmpty

      public boolean isEmpty()
      如果此属性集不包含任何属性,则返回 true
      指定者:
      isEmpty 在接口 AttributeSet
      返回:
      true 如果此属性集不包含任何属性
    • equals

      public boolean equals(Object  object)
      比较指定对象与此属性集的相等性。如果给定对象也是一个属性集并且两个属性集包含相同的属性类别-属性值映射,则返回 true。这可确保 equals() 方法在 AttributeSet 接口的不同实现中正常工作。
      指定者:
      equals 在接口 AttributeSet
      重写:
      equals 在类 Object
      参数:
      object - 与此属性集进行比较
      返回:
      true如果指定的对象等于这个属性集
      参见:
    • hashCode

      public int hashCode()
      返回此属性集的散列码值。属性集的哈希码定义为 AttributeSet 中每个条目的哈希码之和。这确保 t1.equals(t2) 暗示 t1.hashCode()==t2.hashCode() 对于任何两个属性集 t1t2,正如 Object.hashCode() 的总合同所要求的那样。
      指定者:
      hashCode 在接口 AttributeSet
      重写:
      hashCode 在类 Object
      返回:
      此属性集的哈希码值
      参见: