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/DocumentName.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.DocAttribute;
33
import javax.print.attribute.TextSyntax;
34
35
/**
36
* Class {@code DocumentName} is a printing attribute class, a text attribute,
37
* that specifies the name of a document. {@code DocumentName} is an attribute
38
* of the print data (the doc), not of the Print Job. A document's name is an
39
* arbitrary string defined by the client. However if a JobName is not
40
* specified, the {@code DocumentName} should be used instead, which implies
41
* that supporting specification of {@code DocumentName} requires reporting of
42
* JobName and vice versa. See {@link JobName JobName} for more information.
43
* <p>
44
* <b>IPP Compatibility:</b> The string value gives the IPP name value. The
45
* locale gives the IPP natural language. The category name returned by
46
* {@code getName()} gives the IPP attribute name.
47
*
48
* @author Alan Kaminsky
49
*/
50
public final class DocumentName extends TextSyntax implements DocAttribute {
51
52
/**
53
* Use serialVersionUID from JDK 1.4 for interoperability.
54
*/
55
@Serial
56
private static final long serialVersionUID = 7883105848533280430L;
57
58
/**
59
* Constructs a new document name attribute with the given document name and
60
* locale.
61
*
62
* @param documentName document name
63
* @param locale natural language of the text string. {@code null} is
64
* interpreted to mean the default locale as returned by
65
* {@code Locale.getDefault()}
66
* @throws NullPointerException if {@code documentName} is {@code null}
67
*/
68
public DocumentName(String documentName, Locale locale) {
69
super (documentName, locale);
70
}
71
72
/**
73
* Returns whether this document name attribute is equivalent to the passed
74
* in object. To be equivalent, all of the following conditions must be
75
* true:
76
* <ol type=1>
77
* <li>{@code object} is not {@code null}.
78
* <li>{@code object} is an instance of class {@code DocumentName}.
79
* <li>This document name attribute's underlying string and
80
* {@code object}'s underlying string are equal.
81
* <li>This document name attribute's locale and {@code object}'s locale
82
* are equal.
83
* </ol>
84
*
85
* @param object {@code Object} to compare to
86
* @return {@code true} if {@code object} is equivalent to this document
87
* name attribute, {@code false} otherwise
88
*/
89
public boolean equals(Object object) {
90
return (super.equals (object) && object instanceof DocumentName);
91
}
92
93
/**
94
* Get the printing attribute class which is to be used as the "category"
95
* for this printing attribute value.
96
* <p>
97
* For class {@code DocumentName}, the category is class
98
* {@code DocumentName} itself.
99
*
100
* @return printing attribute class (category), an instance of class
101
* {@link Class java.lang.Class}
102
*/
103
public final Class<? extends Attribute> getCategory() {
104
return DocumentName.class;
105
}
106
107
/**
108
* Get the name of the category of which this attribute value is an
109
* instance.
110
* <p>
111
* For class {@code DocumentName}, the category name is
112
* {@code "document-name"}.
113
*
114
* @return attribute category name
115
*/
116
public final String getName() {
117
return "document-name";
118
}
119
}
120
121