Class JobStateReasons
- All Implemented Interfaces:
-
Serializable
,Cloneable
,Iterable<JobStateReason>
,Collection<JobStateReason>
,Set<JobStateReason>
,Attribute
,PrintJobAttribute
public final class JobStateReasons extends HashSet<JobStateReason> implements PrintJobAttribute
JobStateReasons
is a printing attribute class, a set of enumeration values, that provides additional information about the job's current state, i.e., information that augments the value of the job's JobState
attribute. Instances of JobStateReason
do not appear in a Print Job's attribute set directly. Rather, a JobStateReasons
attribute appears in the Print Job's attribute set. The JobStateReasons
attribute contains zero, one, or more than one JobStateReason
objects which pertain to the Print Job's status. The printer adds a JobStateReason
object to the Print Job's JobStateReasons attribute when the corresponding condition becomes true of the Print Job, and the printer removes the JobStateReason
object again when the corresponding condition becomes false, regardless of whether the Print Job's overall JobState
also changed.
Class JobStateReasons
inherits its implementation from class java.util.HashSet
. Unlike most printing attributes which are immutable once constructed, class JobStateReasons
is designed to be mutable; you can add JobStateReason
objects to an existing JobStateReasons
object and remove them again. However, like class java.util.HashSet
, class JobStateReasons
is not multiple thread safe. If a JobStateReasons
object will be used by multiple threads, be sure to synchronize its operations (e.g., using a synchronized set view obtained from class java.util.Collections
).
IPP Compatibility: The string value returned by each individual JobStateReason
object's toString()
method gives the IPP keyword value. The category name returned by getName()
gives the IPP attribute name.
- See Also:
Constructor Summary
Constructor | Description |
---|---|
JobStateReasons() |
Construct a new, empty job state reasons attribute; the underlying hash set has the default initial capacity and load factor. |
JobStateReasons |
Construct a new, empty job state reasons attribute; the underlying hash set has the given initial capacity and the default load factor. |
JobStateReasons |
Construct a new, empty job state reasons attribute; the underlying hash set has the given initial capacity and load factor. |
JobStateReasons |
Construct a new job state reasons attribute that contains the same JobStateReason objects as the given collection. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
boolean |
add |
Adds the specified element to this job state reasons attribute if it is not already present. |
final Class<? extends Attribute> |
getCategory() |
Get the printing attribute class which is to be used as the "category" for this printing attribute value. |
final String |
getName() |
Get the name of the category of which this attribute value is an instance. |
Methods declared in class java.util.HashSet
clear, clone, contains, isEmpty, iterator, remove, size, spliterator, toArray, toArray
Methods declared in class java.util.AbstractSet
equals, hashCode, removeAll
Methods declared in class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
Methods declared in interface java.util.Collection
parallelStream, removeIf, stream, toArray
Constructor Details
JobStateReasons
public JobStateReasons()
JobStateReasons
public JobStateReasons(int initialCapacity)
- Parameters:
-
initialCapacity
- initial capacity - Throws:
-
IllegalArgumentException
- if the initial capacity is negative
JobStateReasons
public JobStateReasons(int initialCapacity, float loadFactor)
- Parameters:
-
initialCapacity
- initial capacity -
loadFactor
- load factor - Throws:
-
IllegalArgumentException
- if the initial capacity is negative
JobStateReasons
public JobStateReasons(Collection<JobStateReason> collection)
JobStateReason
objects as the given collection. The underlying hash set's initial capacity and load factor are as specified in the superclass constructor HashSet(Collection)
.- Parameters:
-
collection
- collection to copy - Throws:
-
NullPointerException
- ifcollection
isnull
or if any element incollection
isnull
-
ClassCastException
- if any element incollection
is not an instance of classJobStateReason
Method Details
add
public boolean add(JobStateReason o)
JobStateReason
. If this job state reasons attribute already contains the specified element, the call leaves this job state reasons attribute unchanged and returns false
.- Specified by:
-
add
in interfaceCollection<JobStateReason>
- Specified by:
-
add
in interfaceSet<JobStateReason>
- Overrides:
-
add
in classHashSet<JobStateReason>
- Parameters:
-
o
- element to be added to this job state reasons attribute - Returns:
-
true
if this job state reasons attribute did not already contain the specified element - Throws:
-
NullPointerException
- if the specified element isnull
-
ClassCastException
- if the specified element is not an instance of classJobStateReason
- Since:
- 1.5
getCategory
public final Class<? extends Attribute> getCategory()
For class JobStateReasons
, the category is class JobStateReasons itself.
- Specified by:
-
getCategory
in interfaceAttribute
- Returns:
- printing attribute class (category), an instance of class
java.lang.Class
getName
public final String getName()
For class JobStateReasons, the category name is "job-state-reasons"
.
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/print/attribute/standard/JobStateReasons.html