Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/DocumentName.java
38918 views
1
/*
2
* Copyright (c) 2000, 2004, 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
package javax.print.attribute.standard;
26
27
import java.util.Locale;
28
29
import javax.print.attribute.Attribute;
30
import javax.print.attribute.TextSyntax;
31
import javax.print.attribute.DocAttribute;
32
33
/**
34
* Class DocumentName is a printing attribute class, a text attribute, that
35
* specifies the name of a document. DocumentName is an attribute of the print
36
* data (the doc), not of the Print Job. A document's name is an arbitrary
37
* string defined by the client.
38
* However if a JobName is not specified, the DocumentName should be used
39
* instead, which implies that supporting specification of DocumentName
40
* requires reporting of JobName and vice versa.
41
* See {@link JobName JobName} for more information.
42
* <P>
43
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
44
* locale gives the IPP natural language. The category name returned by
45
* <CODE>getName()</CODE> gives the IPP attribute name.
46
* <P>
47
*
48
* @author Alan Kaminsky
49
*/
50
public final class DocumentName extends TextSyntax implements DocAttribute {
51
52
private static final long serialVersionUID = 7883105848533280430L;
53
54
/**
55
* Constructs a new document name attribute with the given document name
56
* and locale.
57
*
58
* @param documentName Document name.
59
* @param locale Natural language of the text string. null
60
* is interpreted to mean the default locale as returned
61
* by <code>Locale.getDefault()</code>
62
*
63
* @exception NullPointerException
64
* (unchecked exception) Thrown if <CODE>documentName</CODE> is null.
65
*/
66
public DocumentName(String documentName, Locale locale) {
67
super (documentName, locale);
68
}
69
70
/**
71
* Returns whether this document name attribute is equivalent to the
72
* passed in object.
73
* To be equivalent, all of the following conditions must be true:
74
* <OL TYPE=1>
75
* <LI>
76
* <CODE>object</CODE> is not null.
77
* <LI>
78
* <CODE>object</CODE> is an instance of class DocumentName.
79
* <LI>
80
* This document name attribute's underlying string and
81
* <CODE>object</CODE>'s underlying string are equal.
82
* <LI>
83
* This document name attribute's locale and <CODE>object</CODE>'s locale
84
* are equal.
85
* </OL>
86
*
87
* @param object Object to compare to.
88
*
89
* @return True if <CODE>object</CODE> is equivalent to this document
90
* name attribute, false otherwise.
91
*/
92
public boolean equals(Object object) {
93
return (super.equals (object) && object instanceof DocumentName);
94
}
95
96
/**
97
* Get the printing attribute class which is to be used as the "category"
98
* for this printing attribute value.
99
* <P>
100
* For class DocumentName, the category is class DocumentName itself.
101
*
102
* @return Printing attribute class (category), an instance of class
103
* {@link java.lang.Class java.lang.Class}.
104
*/
105
public final Class<? extends Attribute> getCategory() {
106
return DocumentName.class;
107
}
108
109
/**
110
* Get the name of the category of which this attribute value is an
111
* instance.
112
* <P>
113
* For class DocumentName, the category name is <CODE>"document-name"</CODE>.
114
*
115
* @return Attribute category name.
116
*/
117
public final String getName() {
118
return "document-name";
119
}
120
121
}
122
123