001 /*
002 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.print.attribute.standard;
026
027 import java.util.Locale;
028
029 import javax.print.attribute.Attribute;
030 import javax.print.attribute.TextSyntax;
031 import javax.print.attribute.PrintServiceAttribute;
032
033 /**
034 * Class PrinterInfo is a printing attribute class, a text attribute, that
035 * provides descriptive information about a printer. This could include things
036 * like: <CODE>"This printer can be used for printing color transparencies for
037 * HR presentations"</CODE>, or <CODE>"Out of courtesy for others, please
038 * print only small (1-5 page) jobs at this printer"</CODE>, or even \
039 * <CODE>"This printer is going away on July 1, 1997, please find a new
040 * printer"</CODE>.
041 * <P>
042 * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
043 * locale gives the IPP natural language. The category name returned by
044 * <CODE>getName()</CODE> gives the IPP attribute name.
045 * <P>
046 *
047 * @author Alan Kaminsky
048 */
049 public final class PrinterInfo extends TextSyntax implements
050 PrintServiceAttribute {
051
052 private static final long serialVersionUID = 7765280618777599727L;
053
054 /**
055 * Constructs a new printer info attribute with the given information
056 * string and locale.
057 *
058 * @param info Printer information string.
059 * @param locale Natural language of the text string. null
060 * is interpreted to mean the default locale as returned
061 * by <code>Locale.getDefault()</code>
062 *
063 * @exception NullPointerException
064 * (unchecked exception) Thrown if <CODE>info</CODE> is null.
065 */
066 public PrinterInfo(String info, Locale locale) {
067 super (info, locale);
068 }
069
070 /**
071 * Returns whether this printer info attribute is equivalent to the passed
072 * in object. To be equivalent, all of the following conditions must be
073 * true:
074 * <OL TYPE=1>
075 * <LI>
076 * <CODE>object</CODE> is not null.
077 * <LI>
078 * <CODE>object</CODE> is an instance of class PrinterInfo.
079 * <LI>
080 * This printer info attribute's underlying string and
081 * <CODE>object</CODE>'s underlying string are equal.
082 * <LI>
083 * This printer info attribute's locale and <CODE>object</CODE>'s
084 * locale are equal.
085 * </OL>
086 *
087 * @param object Object to compare to.
088 *
089 * @return True if <CODE>object</CODE> is equivalent to this printer
090 * info attribute, false otherwise.
091 */
092 public boolean equals(Object object) {
093 return (super .equals(object) && object instanceof PrinterInfo);
094 }
095
096 /**
097 * Get the printing attribute class which is to be used as the "category"
098 * for this printing attribute value.
099 * <P>
100 * For class PrinterInfo, the category is class PrinterInfo itself.
101 *
102 * @return Printing attribute class (category), an instance of class
103 * {@link java.lang.Class java.lang.Class}.
104 */
105 public final Class<? extends Attribute> getCategory() {
106 return PrinterInfo.class;
107 }
108
109 /**
110 * Get the name of the category of which this attribute value is an
111 * instance.
112 * <P>
113 * For class PrinterInfo, the category name is <CODE>"printer-info"</CODE>.
114 *
115 * @return Attribute category name.
116 */
117 public final String getName() {
118 return "printer-info";
119 }
120
121 }
|