Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/DocumentName.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.DocAttribute;3132/**33* Class DocumentName is a printing attribute class, a text attribute, that34* specifies the name of a document. DocumentName is an attribute of the print35* data (the doc), not of the Print Job. A document's name is an arbitrary36* string defined by the client.37* However if a JobName is not specified, the DocumentName should be used38* instead, which implies that supporting specification of DocumentName39* requires reporting of JobName and vice versa.40* See {@link JobName JobName} for more information.41* <P>42* <B>IPP Compatibility:</B> The string value gives the IPP name value. The43* locale gives the IPP natural language. The category name returned by44* <CODE>getName()</CODE> gives the IPP attribute name.45* <P>46*47* @author Alan Kaminsky48*/49public final class DocumentName extends TextSyntax implements DocAttribute {5051private static final long serialVersionUID = 7883105848533280430L;5253/**54* Constructs a new document name attribute with the given document name55* and locale.56*57* @param documentName Document name.58* @param locale Natural language of the text string. null59* is interpreted to mean the default locale as returned60* by <code>Locale.getDefault()</code>61*62* @exception NullPointerException63* (unchecked exception) Thrown if <CODE>documentName</CODE> is null.64*/65public DocumentName(String documentName, Locale locale) {66super (documentName, locale);67}6869/**70* Returns whether this document name attribute is equivalent to the71* passed in object.72* To be equivalent, all of the following conditions must be true:73* <OL TYPE=1>74* <LI>75* <CODE>object</CODE> is not null.76* <LI>77* <CODE>object</CODE> is an instance of class DocumentName.78* <LI>79* This document name attribute's underlying string and80* <CODE>object</CODE>'s underlying string are equal.81* <LI>82* This document name attribute's locale and <CODE>object</CODE>'s locale83* are equal.84* </OL>85*86* @param object Object to compare to.87*88* @return True if <CODE>object</CODE> is equivalent to this document89* name attribute, false otherwise.90*/91public boolean equals(Object object) {92return (super.equals (object) && object instanceof DocumentName);93}9495/**96* Get the printing attribute class which is to be used as the "category"97* for this printing attribute value.98* <P>99* For class DocumentName, the category is class DocumentName itself.100*101* @return Printing attribute class (category), an instance of class102* {@link java.lang.Class java.lang.Class}.103*/104public final Class<? extends Attribute> getCategory() {105return DocumentName.class;106}107108/**109* Get the name of the category of which this attribute value is an110* instance.111* <P>112* For class DocumentName, the category name is <CODE>"document-name"</CODE>.113*114* @return Attribute category name.115*/116public final String getName() {117return "document-name";118}119120}121122123