public final class PrinterStateReasons extends HashMap<PrinterStateReason,Severity> implements PrintServiceAttribute
PrinterState属性值的信息。
PrinterStateReason的实例不会直接出现在打印服务的属性集中。 相反,PrinterStateReasons属性出现在打印服务的属性集中。 的PrinterStateReasons属性包含零个,一个或多于一个PrinterStateReason ,其涉及到打印服务的状态的对象,并且每个PrinterStateReason对象与相关联Severity水平REPORT(最不严重),警告或错误(最严重)的。 当打印机的相应条件变为真时,打印机将PrinterStateReason对象添加到打印服务的PrinterStateReasons属性,而当相应条件变为false时,打印机将再次删除PrinterStateReason对象,无论打印服务的整体PrinterState是否也更改。
PrinterStateReasons类继承自java.util.HashMap类的实现 。 地图中的每个条目由PrinterStateReason对象(关键字)映射到Severity对象(值)组成:
与大多数不可变的打印属性不同,PrinterStateReasons类被设计为可变的; 您可以将PrinterStateReason对象添加到现有的PrinterStateReasons对象中,并再次删除它们。 但是,像java.util.HashMap类一样, PrinterStateReasons类不是多线程安全的。 如果多个线程使用PrinterStateReasons对象,请确保同步其操作(例如,使用从类别java.util.Collections获取的同步映射视图)。
IPP兼容性:每个单独的PrinterStateReason对象和相关联的Severity对象的toString()方法返回的字符串值与其间连字符( "-" )连接在一起,提供IPP关键字值。 由getName()返回的类别名称提供IPP属性名称。
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
PrinterStateReasons()
构造一个新的,空的打印机状态原因属性;
底层哈希映射具有默认的初始容量和负载因子。
|
PrinterStateReasons(int initialCapacity)
超级新的,空的打印机状态原因属性;
底层哈希映射具有给定的初始容量和默认负载因子。
|
PrinterStateReasons(int initialCapacity, float loadFactor)
构造一个新的,空的打印机状态原因属性;
底层哈希映射具有给定的初始容量和负载因子。
|
PrinterStateReasons(Map<PrinterStateReason,Severity> map)
构造一个新的打印机状态原因属性,其中包含与给定地图相同的 PrinterStateReason- to-Severity映射。
|
| Modifier and Type | Method and Description |
|---|---|
类<? extends Attribute> |
getCategory()
获取要用作此打印属性值的“类别”的打印属性类。
|
String |
getName()
获取此属性值是一个实例的类别的名称。
|
Set<PrinterStateReason> |
printerStateReasonSet(Severity severity)
在此PrinterStateReasons属性中,以给定的严重级别获取不可修改的打印机状态原因属性的集合视图。
|
Severity |
put(PrinterStateReason reason, Severity severity)
将给定的打印机状态原因添加到此打印机状态原因属性,将其与给定的严重性级别相关联。
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesequals, hashCode, toStringpublic PrinterStateReasons()
public PrinterStateReasons(int initialCapacity)
initialCapacity - 初始容量。
IllegalArgumentException - 如果初始容量小于零。
public PrinterStateReasons(int initialCapacity,
float loadFactor)
initialCapacity - 初始容量。
loadFactor - 负载系数。
IllegalArgumentException - 如果初始容量小于零。
public PrinterStateReasons(Map<PrinterStateReason,Severity> map)
PrinterStateReason至Severity映射。
底层哈希映射的初始容量和负载因子在超类构造函数HashMap(Map)中指定 。
map - 地图复制。
NullPointerException - (未经检查的异常)如果摔出
map为null,或者在任意键或值
map为空。
ClassCastException - (未经检查的异常)如果map中的任何键不是PrinterStateReason类的实例,或者map中的任何值不是Severity类的实例,则抛出 。
public Severity put(PrinterStateReason reason, Severity severity)
put在界面
Map<PrinterStateReason,Severity>
put在
HashMap<PrinterStateReason,Severity>
reason - 打印机状态原因。
这必须是PrinterStateReason类的一个实例。
severity - 打印机状态原因的严重性。
这必须是Severity类的一个实例。
NullPointerException - (未经检查的异常)如果
reason为空或
severity为空,则抛出。
ClassCastException - (未经检查的异常)如果reason不是PrinterStateReason类的实例,或者如果severity不是Severity类的实例,则抛出 。
public final 类<? extends Attribute> getCategory()
对于PrinterStateReasons类,该类别是PrinterStateReasons类本身。
getCategory在界面
Attribute
java.lang.Class的一个实例。
public final String getName()
对于PrinterStateReasons类,类别名称为"printer-state-reasons" 。
public Set<PrinterStateReason> printerStateReasonSet(Severity severity)
PrinterStateReason对象。
集合视图中唯一的元素是映射到给定严重性值的PrinterStateReason对象。
该设置视图由此PrinterStateReasons属性支持,因此对此PrinterStateReasons属性的更改反映在设置视图中。
设置视图不支持元素插入或删除。
设置视图的迭代器不支持元素删除。
severity - 严重程度。
Severity级别设置个人PrinterStateReason属性的视图。
NullPointerException - (未选中的异常)如果
severity为空,则抛出。
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.