模块 java.desktop

接口 DocAttributeSet

所有父级接口:
AttributeSet
所有已知的实现类:
HashDocAttributeSet

public interface DocAttributeSet extends AttributeSet
接口 DocAttributeSet 指定一组文档属性的接口,即实现接口 DocAttribute 的打印属性。在打印服务 API 中,客户端使用 DocAttributeSet 来指定单个文档的特征以及要应用于单个文档的打印作业设置。

DocAttributeSet 只是一个 AttributeSet ,其构造函数和变异操作保证了一个额外的不变量,即 DocAttributeSet 中的所有属性值必须是接口 DocAttribute 的实例。 add(Attribute) addAll(AttributeSet) 操作在下面重新指定以保证这个额外的不变量。

  • 方法详情

    • add

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

      boolean addAll(AttributeSet  attributes)
      将指定集中的所有元素添加到此属性。结果与 add(Attribute) 操作已连续应用到此属性集与指定集中的每个元素相同。如果指定集中的所有类别都与此属性集中的任何类别相同,addAll() 操作会有效地修改此属性集,使其值为union两组中的。

      addAll() 操作的行为是未指定的,如果指定的集合在操作过程中被修改。

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

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