OutputDeviceAssigned.java revision 17757:ad37f4ce2062
1/* 2 * Copyright (c) 2000, 2017, 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 26package javax.print.attribute.standard; 27 28import java.util.Locale; 29 30import javax.print.attribute.Attribute; 31import javax.print.attribute.PrintJobAttribute; 32import javax.print.attribute.TextSyntax; 33 34/** 35 * Class {@code OutputDeviceAssigned} is a printing attribute class, a text 36 * attribute, that identifies the output device to which the service has 37 * assigned this job. If an output device implements an embedded Print Service 38 * instance, the printer need not set this attribute. If a print server 39 * implements a Print Service instance, the value may be empty (zero- length 40 * string) or not returned until the service assigns an output device to the 41 * job. This attribute is particularly useful when a single service supports 42 * multiple devices (so called "fan-out"). 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 */ 50public final class OutputDeviceAssigned extends TextSyntax 51 implements PrintJobAttribute { 52 53 /** 54 * Use serialVersionUID from JDK 1.4 for interoperability. 55 */ 56 private static final long serialVersionUID = 5486733778854271081L; 57 58 /** 59 * Constructs a new output device assigned attribute with the given device 60 * name and locale. 61 * 62 * @param deviceName device 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 deviceName} is {@code null} 67 */ 68 public OutputDeviceAssigned(String deviceName, Locale locale) { 69 70 super (deviceName, locale); 71 } 72 73 // Exported operations inherited and overridden from class Object. 74 75 /** 76 * Returns whether this output device assigned attribute is equivalent to 77 * the passed in object. To be equivalent, all of the following conditions 78 * must be true: 79 * <ol type=1> 80 * <li>{@code object} is not {@code null}. 81 * <li>{@code object} is an instance of class 82 * {@code OutputDeviceAssigned}. 83 * <li>This output device assigned attribute's underlying string and 84 * {@code object}'s underlying string are equal. 85 * <li>This output device assigned attribute's locale and {@code object}'s 86 * locale are equal. 87 * </ol> 88 * 89 * @param object {@code Object} to compare to 90 * @return {@code true} if {@code object} is equivalent to this output 91 * device assigned attribute, {@code false} otherwise 92 */ 93 public boolean equals(Object object) { 94 return (super.equals (object) && 95 object instanceof OutputDeviceAssigned); 96 } 97 98 /** 99 * Get the printing attribute class which is to be used as the "category" 100 * for this printing attribute value. 101 * <p> 102 * For class {@code OutputDeviceAssigned}, the category is class 103 * {@code OutputDeviceAssigned} itself. 104 * 105 * @return printing attribute class (category), an instance of class 106 * {@link Class java.lang.Class} 107 */ 108 public final Class<? extends Attribute> getCategory() { 109 return OutputDeviceAssigned.class; 110 } 111 112 /** 113 * Get the name of the category of which this attribute value is an 114 * instance. 115 * <p> 116 * For class {@code OutputDeviceAssigned}, the category name is 117 * {@code "output-device-assigned"}. 118 * 119 * @return attribute category name 120 */ 121 public final String getName() { 122 return "output-device-assigned"; 123 } 124} 125