KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > print > attribute > standard > PrinterName


1 /*
2  * @(#)PrinterName.java 1.9 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.print.attribute.standard;
8
9 import java.util.Locale JavaDoc;
10
11 import javax.print.attribute.Attribute JavaDoc;
12 import javax.print.attribute.TextSyntax JavaDoc;
13 import javax.print.attribute.PrintServiceAttribute JavaDoc;
14
15 /**
16  * Class PrinterName is a printing attribute class, a text attribute, that
17  * specifies the name of a printer. It is a name that is more end-user friendly
18  * than a URI. An administrator determines a printer's name and sets this
19  * attribute to that name. This name may be the last part of the printer's URI
20  * or it may be unrelated. In non-US-English locales, a name may contain
21  * characters that are not allowed in a URI.
22  * <P>
23  * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
24  * locale gives the IPP natural language. The category name returned by
25  * <CODE>getName()</CODE> gives the IPP attribute name.
26  * <P>
27  *
28  * @author Alan Kaminsky
29  */

30 public final class PrinterName extends TextSyntax JavaDoc
31     implements PrintServiceAttribute JavaDoc {
32
33     private static final long serialVersionUID = 299740639137803127L;
34
35     /**
36      * Constructs a new printer name attribute with the given name and locale.
37      *
38      * @param printerName Printer name.
39      * @param locale Natural language of the text string. null
40      * is interpreted to mean the default locale as returned
41      * by <code>Locale.getDefault()</code>
42      *
43      * @exception NullPointerException
44      * (unchecked exception) Thrown if <CODE>printerName</CODE> is null.
45      */

46     public PrinterName(String JavaDoc printerName, Locale JavaDoc locale) {
47     super (printerName, locale);
48     }
49
50     /**
51      * Returns whether this printer name attribute is equivalent to the passed
52      * in object. To be equivalent, all of the following conditions must be
53      * true:
54      * <OL TYPE=1>
55      * <LI>
56      * <CODE>object</CODE> is not null.
57      * <LI>
58      * <CODE>object</CODE> is an instance of class PrinterName.
59      * <LI>
60      * This printer name attribute's underlying string and
61      * <CODE>object</CODE>'s underlying string are equal.
62      * <LI>
63      * This printer name attribute's locale and <CODE>object</CODE>'s locale
64      * are equal.
65      * </OL>
66      *
67      * @param object Object to compare to.
68      *
69      * @return True if <CODE>object</CODE> is equivalent to this printer
70      * name attribute, false otherwise.
71      */

72     public boolean equals(Object JavaDoc object) {
73     return (super.equals(object) && object instanceof PrinterName JavaDoc);
74     }
75
76     /**
77      * Get the printing attribute class which is to be used as the "category"
78      * for this printing attribute value.
79      * <P>
80      * For class PrinterName, the category is
81      * class PrinterName itself.
82      *
83      * @return Printing attribute class (category), an instance of class
84      * {@link java.lang.Class java.lang.Class}.
85      */

86     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
87     return PrinterName JavaDoc.class;
88     }
89
90     /**
91      * Get the name of the category of which this attribute value is an
92      * instance.
93      * <P>
94      * For class PrinterName, the category
95      * name is <CODE>"printer-name"</CODE>.
96      *
97      * @return Attribute category name.
98      */

99     public final String JavaDoc getName() {
100     return "printer-name";
101     }
102
103 }
104
Popular Tags