KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)PrinterInfo.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 PrinterInfo is a printing attribute class, a text attribute, that
17  * provides descriptive information about a printer. This could include things
18  * like: <CODE>"This printer can be used for printing color transparencies for
19  * HR presentations"</CODE>, or <CODE>"Out of courtesy for others, please
20  * print only small (1-5 page) jobs at this printer"</CODE>, or even \
21  * <CODE>"This printer is going away on July 1, 1997, please find a new
22  * printer"</CODE>.
23  * <P>
24  * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
25  * locale gives the IPP natural language. The category name returned by
26  * <CODE>getName()</CODE> gives the IPP attribute name.
27  * <P>
28  *
29  * @author Alan Kaminsky
30  */

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

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

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

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

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