Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/JobName.java
38918 views
/*1* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package javax.print.attribute.standard;2526import java.util.Locale;2728import javax.print.attribute.Attribute;29import javax.print.attribute.TextSyntax;30import javax.print.attribute.PrintRequestAttribute;31import javax.print.attribute.PrintJobAttribute;3233/**34* Class JobName is a printing attribute class, a text attribute, that specifies35* the name of a print job. A job's name is an arbitrary string defined by the36* client. It does not need to be unique between different jobs. A Print Job's37* JobName attribute is set to the value supplied by the client in the Print38* Request's attribute set. If, however, the client does not supply a JobName39* attribute in the Print Request, the printer, when it creates the Print Job,40* must generate a JobName. The printer should generate the value of the Print41* Job's JobName attribute from the first of the following sources that produces42* a value: (1) the {@link DocumentName DocumentName} attribute of the first (or43* only) doc in the job, (2) the URL of the first (or only) doc in the job, if44* the doc's print data representation object is a URL, or (3) any other piece45* of Print Job specific and/or document content information.46* <P>47* <B>IPP Compatibility:</B> The string value gives the IPP name value. The48* locale gives the IPP natural language. The category name returned by49* <CODE>getName()</CODE> gives the IPP attribute name.50* <P>51*52* @author Alan Kaminsky53*/54public final class JobName extends TextSyntax55implements PrintRequestAttribute, PrintJobAttribute {5657private static final long serialVersionUID = 4660359192078689545L;5859/**60* Constructs a new job name attribute with the given job name and locale.61*62* @param jobName Job name.63* @param locale Natural language of the text string. null64* is interpreted to mean the default locale as returned65* by <code>Locale.getDefault()</code>66*67* @exception NullPointerException68* (unchecked exception) Thrown if <CODE>jobName</CODE> is null.69*/70public JobName(String jobName, Locale locale) {71super (jobName, locale);72}7374/**75* Returns whether this job name attribute is equivalent to the passed in76* object. To be equivalent, all of the following conditions must be true:77* <OL TYPE=1>78* <LI>79* <CODE>object</CODE> is not null.80* <LI>81* <CODE>object</CODE> is an instance of class JobName.82* <LI>83* This job name attribute's underlying string and <CODE>object</CODE>'s84* underlying string are equal.85* <LI>86* This job name attribute's locale and <CODE>object</CODE>'s locale are87* equal.88* </OL>89*90* @param object Object to compare to.91*92* @return True if <CODE>object</CODE> is equivalent to this job name93* attribute, false otherwise.94*/95public boolean equals(Object object) {96return (super.equals(object) && object instanceof JobName);97}9899/**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 JobName, the category is class JobName itself.104*105* @return Printing attribute class (category), an instance of class106* {@link java.lang.Class java.lang.Class}.107*/108public final Class<? extends Attribute> getCategory() {109return JobName.class;110}111112/**113* Get the name of the category of which this attribute value is an114* instance.115* <P>116* For class JobName, the category name is <CODE>"job-name"</CODE>.117*118* @return Attribute category name.119*/120public final String getName() {121return "job-name";122}123124}125126127