JavaTM 2 Platform
Standard Ed. 6

javax.print.attribute.standard
类 JobStateReasons

java.lang.Object
  继承者 java.util.AbstractCollection<E>
      继承者 java.util.AbstractSet<E>
          继承者 java.util.HashSet<JobStateReason>
              继承者 javax.print.attribute.standard.JobStateReasons
所有已实现的接口:
Serializable, Cloneable, Iterable<JobStateReason>, Collection<JobStateReason>, Set<JobStateReason>, Attribute, PrintJobAttribute

public final class JobStateReasons
extends HashSet<JobStateReason>
implements PrintJobAttribute

JobStateReasons 类是打印属性类,它是一个枚举值集合,提供了有关作业当前状态的额外信息,即扩充作业的 JobState 属性值的信息。

JobStateReason 的实例不直接出现在 Print Job 的属性集中。但是,JobStateReasons 属性出现在 Print Job 的属性集中。JobStateReasons 属性包含零个、一个或多个 JobStateReason 对象,它们属于 Print Job 的状态。当 Print Job 的对应条件变为 true 时,打印机将 JobStateReason 对象添加到 Print Job 的 JobStateReasons 属性,且当对应条件变为 false 时,再移除 JobStateReason 对象,而不管 Print Job 的总体 JobState 是否也更改。

JobStateReasons 类从 java.util.HashSet 类继承其实现。与大多数构造后不可变的打印属性不同,我们把 JobStateReasons 类设计为可变的,您可以将 JobStateReason 对象添加到现有 JobStateReasons 对象中,也可以再移除它们。但是,与 java.util.HashSet 类一样, JobStateReasons 类不是多线程安全的。如果 JobStateReasons 对象将供多个线程使用,则要保证使其操作同步(例如,使用从 java.util.Collections 类获取的同步 set 视图)。

IPP 兼容性:每个单个 JobStateReason 对象的 toString() 方法所返回的字符串值给出了 IPP 关键字值。getName() 所返回的类别名称给出了 IPP 属性名称。

另请参见:
序列化表格

构造方法摘要
JobStateReasons()
          构造新的空作业状态原因属性;底层哈希集合具有默认的初始容量和加载因子。
JobStateReasons(Collection<JobStateReason> collection)
          构造新的作业状态原因属性,它包含与给定集合相同的 JobStateReason 对象。
JobStateReasons(int initialCapacity)
          构造新的空作业状态原因属性;底层哈希集合具有给定的初始容量和默认的加载因子。
JobStateReasons(int initialCapacity, float loadFactor)
          构造新的空作业状态原因属性;底层哈希集合具有给定的容量和加载因子。
 
方法摘要
 boolean add(JobStateReason o)
          将指定的元素添加到此作业状态原因属性(如果它尚未存在)。
 Class<? extends Attribute> getCategory()
          获取将被用作此打印属性值的“类别”的打印属性类。
 String getName()
          获取类别名称,此属性值为该类别的实例。
 
从类 java.util.HashSet 继承的方法
clear, clone, contains, isEmpty, iterator, remove, size
 
从类 java.util.AbstractSet 继承的方法
equals, hashCode, removeAll
 
从类 java.util.AbstractCollection 继承的方法
addAll, containsAll, retainAll, toArray, toArray, toString
 
从类 java.lang.Object 继承的方法
finalize, getClass, notify, notifyAll, wait, wait, wait
 
从接口 java.util.Set 继承的方法
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

构造方法详细信息

JobStateReasons

public JobStateReasons()
构造新的空作业状态原因属性;底层哈希集合具有默认的初始容量和加载因子。


JobStateReasons

public JobStateReasons(int initialCapacity)
构造新的空作业状态原因属性;底层哈希集合具有给定的初始容量和默认的加载因子。

参数:
initialCapacity - 初始容量。
抛出:
IllegalArgumentException - 如果初始容量小于零。

JobStateReasons

public JobStateReasons(int initialCapacity,
                       float loadFactor)
构造新的空作业状态原因属性;底层哈希集合具有给定的容量和加载因子。

参数:
initialCapacity - 初始容量。
loadFactor - 加载因子。
抛出:
IllegalArgumentException - 如果初始容量小于零。

JobStateReasons

public JobStateReasons(Collection<JobStateReason> collection)
构造新的作业状态原因属性,它包含与给定集合相同的 JobStateReason 对象。底层哈希集合的初始容量和加载因子如超类构造方法 HashSet(Collection) 中所指定的那样。

参数:
collection - 要复制的集合。
抛出:
NullPointerException - (未检查的异常)如果 collection 为 null,或 collection 中任何元素为 null,则抛出此异常。
ClassCastException - (未检查的异常)如果 collection 中任何元素不是 JobStateReason 类的实例,则抛出此异常。
方法详细信息

add

public boolean add(JobStateReason o)
将指定的元素添加到此作业状态原因属性(如果它尚未存在)。要添加的元素必须为 JobStateReason 类的实例。如果此作业状态原因属性已经包含指定的元素,则该调用不改变此作业状态原因属性并返回 false

指定者:
接口 Collection<JobStateReason> 中的 add
指定者:
接口 Set<JobStateReason> 中的 add
覆盖:
HashSet<JobStateReason> 中的 add
参数:
o - 将要添加到此作业状态原因属性中的元素。
返回:
如果此作业状态原因属性不包含指定的元素,则返回 true
抛出:
NullPointerException - (未检查的异常)如果指定的元素为 null,则抛出此异常。
ClassCastException - (未检查的异常)如果指定的元素不是 JobStateReason 类的实例,则抛出此异常。
从以下版本开始:
1.5

getCategory

public final Class<? extends Attribute> getCategory()
获取将被用作此打印属性值的“类别”的打印属性类。

对于 JobStateReasons 类,类别为 JobStateReasons 类本身。

指定者:
接口 Attribute 中的 getCategory
返回:
打印属性类(类别),它是 java.lang.Class 类的实例。

getName

public final String getName()
获取类别名称,此属性值为该类别的实例。

对于 JobStateReasons 类,类别名称为 "job-state-reasons"

指定者:
接口 Attribute 中的 getName
返回:
属性类别名称。

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

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