JavaTM 2 Platform
Standard Ed. 6

javax.print.attribute
介面 PrintServiceAttributeSet

所有父級介面:
AttributeSet
所有已知實作類別:
HashPrintServiceAttributeSet

public interface PrintServiceAttributeSet
extends AttributeSet

介面 PrintServiceAttributeSet 為列印作業屬性(即:實作介面 PrintServiceAttribute 的列印屬性)集指定介面。在“列印服務”API 中,“列印服務”實例使用 PrintServiceAttributeSet 報告列印服務的狀態。

PrintServiceAttributeSet 就是 AttributeSet,其建構子和更改操作保證一個附加的不變數,即 PrintServiceAttributeSet 中的所有屬性值必須是介面 PrintServiceAttribute 的實例。下面重新指定了 add(Attribute)addAll(AttributeSet) 操作,以保證此附加不變數。


方法摘要
 boolean add(Attribute attribute)
          如果指定的屬性值不存在,則將其添加到此屬性集中,方法是首先移除與指定屬性值相同的屬性類別別中的任何現有值(可選操作)。
 boolean addAll(AttributeSet attributes)
          將指定集合中的所有元素添加到此屬性中。
 
從介面 javax.print.attribute.AttributeSet 繼承的方法
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, remove, remove, size, toArray
 

方法詳細資訊

add

boolean add(Attribute attribute)
如果指定的屬性值不存在,則將其添加到此屬性集中,方法是首先移除與指定屬性值相同的屬性類別別中的任何現有值(可選操作)。

指定者:
介面 AttributeSet 中的 add
參數:
attribute - 要添加到此屬性集的屬性值。
返回:
如果此屬性集由於調用而發生改變(即:給定的屬性值還不是此屬性集的成員),則返回 true
拋出:
UnmodifiableSetException - (未經檢查的異常)如果此屬性集不支持 add() 操作,則拋出該異常。
ClassCastException - (未經檢查的異常)如果 attribute 不是介面 PrintServiceAttribute 的一個實例,則拋出該異常。
NullPointerException - (未經檢查的異常)如果 attribute 為 null,則拋出該異常。

addAll

boolean addAll(AttributeSet attributes)
將指定集合中的所有元素添加到此屬性中。該結果與使用指定集合中的每個元素將 add(Attribute) 操作成功地應用到此屬性集中相同。如果指定集合中的任何類別別都與此屬性集中的類別別不相同,則 addAll() 操作會有效地修改此屬性集,使其值成為兩個集合的並集

如果正在進行此操作的同時修改了指定的集合,則 addAll() 操作的行為是不確定的。

如果 addAll() 操作拋出一個異常,則對此屬性集狀態的影響取決於實作方法;在異常點之前,不一定將指定集合中的元素添加到了此屬性集。

指定者:
介面 AttributeSet 中的 addAll
參數:
attributes - 要將其元素添加到此屬性集中的屬性。
返回:
如果此屬性集由於調用而發生改變,則返回 true
拋出:
UnmodifiableSetException - (未經檢查的異常)如果此屬性集不支持 addAll() 方法,則拋出該異常。
ClassCastException - (未經檢查的異常)如果指定集中的某個元素不是介面 PrintServiceAttribute 的一個實例,則拋出該異常。
NullPointerException - (未經檢查的異常)如果指定的集合為 null,則拋出該異常。
另請參見:
add(Attribute)

JavaTM 2 Platform
Standard Ed. 6

提交錯誤或意見

版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only