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.PrintServiceAttribute; 32 33 /** 34 * Class PrinterMessageFromOperator is a printing attribute class, a text 35 * attribute, that provides a message from an operator, system administrator, 36 * or "intelligent" process to indicate to the end user information about or 37 * status of the printer, such as why it is unavailable or when it is 38 * expected to be available. 39 * <P> 40 * A Print Service's attribute set includes zero instances or one instance of 41 * a 42 * PrinterMessageFromOperator attribute, not more than one instance. A new 43 * PrinterMessageFromOperator attribute replaces an existing 44 * PrinterMessageFromOperator attribute, if any. In other words, 45 * PrinterMessageFromOperator is not intended to be a history log. 46 * If it wishes, the client can detect changes to a Print Service's 47 * PrinterMessageFromOperator 48 * attribute and maintain the client's own history log of the 49 * PrinterMessageFromOperator attribute values. 50 * <P> 51 * <B>IPP Compatibility:</B> The string value gives the IPP name value. The 52 * locale gives the IPP natural language. The category name returned by 53 * <CODE>getName()</CODE> gives the IPP attribute name. 54 * <P> 55 * 56 * @author Alan Kaminsky 57 */ 58 public final class PrinterMessageFromOperator extends TextSyntax 59 implements PrintServiceAttribute { 60 61 static final long serialVersionUID = -4486871203218629318L; 62 63 /** 64 * Constructs a new printer message from operator attribute with the 65 * given message and locale. 66 * 67 * @param message Message. 68 * @param locale Natural language of the text string. null 69 * is interpreted to mean the default locale as returned 70 * by <code>Locale.getDefault()</code> 71 * 72 * @exception NullPointerException 73 * (unchecked exception) Thrown if <CODE>message</CODE> is null. 74 */ 75 public PrinterMessageFromOperator(String message, Locale locale) { 76 super (message, locale); 77 } 78 79 /** 80 * Returns whether this printer message from operator attribute is 81 * equivalent to the passed in object. To be equivalent, all of the 82 * following conditions must be true: 83 * <OL TYPE=1> 84 * <LI> 85 * <CODE>object</CODE> is not null. 86 * <LI> 87 * <CODE>object</CODE> is an instance of class 88 * PrinterMessageFromOperator. 89 * <LI> 90 * This printer message from operator attribute's underlying string and 91 * <CODE>object</CODE>'s underlying string are equal. 92 * <LI> 93 * This printer message from operator attribute's locale and 94 * <CODE>object</CODE>'s locale are equal. 95 * </OL> 96 * 97 * @param object Object to compare to. 98 * 99 * @return True if <CODE>object</CODE> is equivalent to this printer 100 * message from operator attribute, false otherwise. 101 */ 102 public boolean equals(Object object) { 103 return (super.equals(object) && 104 object instanceof PrinterMessageFromOperator); 105 } 106 107 /** 108 * Get the printing attribute class which is to be used as the "category" 109 * for this printing attribute value. 110 * <P> 111 * For class PrinterMessageFromOperator, 112 * the category is class PrinterMessageFromOperator itself. 113 * 114 * @return Printing attribute class (category), an instance of class 115 * {@link java.lang.Class java.lang.Class}. 116 */ 117 public final Class<? extends Attribute> getCategory() { 118 return PrinterMessageFromOperator.class; 119 } 120 121 /** 122 * Get the name of the category of which this attribute value is an 123 * instance. 124 * <P> 125 * For class PrinterMessageFromOperator, 126 * the category name is <CODE>"printer-message-from-operator"</CODE>. 127 * 128 * @return Attribute category name. 129 */ 130 public final String getName() { 131 return "printer-message-from-operator"; 132 } 133 134 }