Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/JobName.java
41171 views
1
/*
2
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.print.attribute.standard;
27
28
import java.io.Serial;
29
import java.util.Locale;
30
31
import javax.print.attribute.Attribute;
32
import javax.print.attribute.PrintJobAttribute;
33
import javax.print.attribute.PrintRequestAttribute;
34
import javax.print.attribute.TextSyntax;
35
36
/**
37
* Class {@code JobName} is a printing attribute class, a text attribute, that
38
* specifies the name of a print job. A job's name is an arbitrary string
39
* defined by the client. It does not need to be unique between different jobs.
40
* A Print Job's {@code JobName} attribute is set to the value supplied by the
41
* client in the Print Request's attribute set. If, however, the client does not
42
* supply a {@code JobName} attribute in the Print Request, the printer, when it
43
* creates the Print Job, must generate a {@code JobName}. The printer should
44
* generate the value of the Print Job's {@code JobName} attribute from the
45
* first of the following sources that produces a value: (1) the
46
* {@link DocumentName DocumentName} attribute of the first (or only) doc in the
47
* job, (2) the {@code URL} of the first (or only) doc in the job, if the doc's
48
* print data representation object is a {@code URL}, or (3) any other piece of
49
* Print Job specific and/or document content information.
50
* <p>
51
* <b>IPP Compatibility:</b> The string value gives the IPP name value. The
52
* locale gives the IPP natural language. The category name returned by
53
* {@code getName()} gives the IPP attribute name.
54
*
55
* @author Alan Kaminsky
56
*/
57
public final class JobName extends TextSyntax
58
implements PrintRequestAttribute, PrintJobAttribute {
59
60
/**
61
* Use serialVersionUID from JDK 1.4 for interoperability.
62
*/
63
@Serial
64
private static final long serialVersionUID = 4660359192078689545L;
65
66
/**
67
* Constructs a new job name attribute with the given job name and locale.
68
*
69
* @param jobName job name
70
* @param locale natural language of the text string. {@code null} is
71
* interpreted to mean the default locale as returned by
72
* {@code Locale.getDefault()}
73
* @throws NullPointerException if {@code jobName} is {@code null}
74
*/
75
public JobName(String jobName, Locale locale) {
76
super (jobName, locale);
77
}
78
79
/**
80
* Returns whether this job name attribute is equivalent to the passed in
81
* object. To be equivalent, all of the following conditions must be true:
82
* <ol type=1>
83
* <li>{@code object} is not {@code null}.
84
* <li>{@code object} is an instance of class {@code JobName}.
85
* <li>This job name attribute's underlying string and {@code object}'s
86
* underlying string are equal.
87
* <li>This job name attribute's locale and {@code object}'s locale are
88
* equal.
89
* </ol>
90
*
91
* @param object {@code Object} to compare to
92
* @return {@code true} if {@code object} is equivalent to this job name
93
* attribute, {@code false} otherwise
94
*/
95
public boolean equals(Object object) {
96
return (super.equals(object) && object instanceof JobName);
97
}
98
99
/**
100
* Get the printing attribute class which is to be used as the "category"
101
* for this printing attribute value.
102
* <p>
103
* For class {@code JobName}, the category is class {@code JobName} itself.
104
*
105
* @return printing attribute class (category), an instance of class
106
* {@link Class java.lang.Class}
107
*/
108
public final Class<? extends Attribute> getCategory() {
109
return JobName.class;
110
}
111
112
/**
113
* Get the name of the category of which this attribute value is an
114
* instance.
115
* <p>
116
* For class {@code JobName}, the category name is {@code "job-name"}.
117
*
118
* @return attribute category name
119
*/
120
public final String getName() {
121
return "job-name";
122
}
123
}
124
125