Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/OutputDeviceAssigned.java
41171 views
/*1* Copyright (c) 2000, 2021, 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*/2425package javax.print.attribute.standard;2627import java.io.Serial;28import java.util.Locale;2930import javax.print.attribute.Attribute;31import javax.print.attribute.PrintJobAttribute;32import javax.print.attribute.TextSyntax;3334/**35* Class {@code OutputDeviceAssigned} is a printing attribute class, a text36* attribute, that identifies the output device to which the service has37* assigned this job. If an output device implements an embedded Print Service38* instance, the printer need not set this attribute. If a print server39* implements a Print Service instance, the value may be empty (zero- length40* string) or not returned until the service assigns an output device to the41* job. This attribute is particularly useful when a single service supports42* multiple devices (so called "fan-out").43* <p>44* <b>IPP Compatibility:</b> The string value gives the IPP name value. The45* locale gives the IPP natural language. The category name returned by46* {@code getName()} gives the IPP attribute name.47*48* @author Alan Kaminsky49*/50public final class OutputDeviceAssigned extends TextSyntax51implements PrintJobAttribute {5253/**54* Use serialVersionUID from JDK 1.4 for interoperability.55*/56@Serial57private static final long serialVersionUID = 5486733778854271081L;5859/**60* Constructs a new output device assigned attribute with the given device61* name and locale.62*63* @param deviceName device name64* @param locale natural language of the text string. {@code null} is65* interpreted to mean the default locale as returned by66* {@code Locale.getDefault()}67* @throws NullPointerException if {@code deviceName} is {@code null}68*/69public OutputDeviceAssigned(String deviceName, Locale locale) {7071super (deviceName, locale);72}7374// Exported operations inherited and overridden from class Object.7576/**77* Returns whether this output device assigned attribute is equivalent to78* the passed in object. To be equivalent, all of the following conditions79* must be true:80* <ol type=1>81* <li>{@code object} is not {@code null}.82* <li>{@code object} is an instance of class83* {@code OutputDeviceAssigned}.84* <li>This output device assigned attribute's underlying string and85* {@code object}'s underlying string are equal.86* <li>This output device assigned attribute's locale and {@code object}'s87* locale are equal.88* </ol>89*90* @param object {@code Object} to compare to91* @return {@code true} if {@code object} is equivalent to this output92* device assigned attribute, {@code false} otherwise93*/94public boolean equals(Object object) {95return (super.equals (object) &&96object instanceof OutputDeviceAssigned);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 {@code OutputDeviceAssigned}, the category is class104* {@code OutputDeviceAssigned} itself.105*106* @return printing attribute class (category), an instance of class107* {@link Class java.lang.Class}108*/109public final Class<? extends Attribute> getCategory() {110return OutputDeviceAssigned.class;111}112113/**114* Get the name of the category of which this attribute value is an115* instance.116* <p>117* For class {@code OutputDeviceAssigned}, the category name is118* {@code "output-device-assigned"}.119*120* @return attribute category name121*/122public final String getName() {123return "output-device-assigned";124}125}126127128