KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)PrinterURI.java 1.6 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.net.URI JavaDoc;
10 import java.util.Locale JavaDoc;
11
12 import javax.print.attribute.Attribute JavaDoc;
13 import javax.print.attribute.URISyntax JavaDoc;
14 import javax.print.attribute.PrintServiceAttribute JavaDoc;
15
16 /**
17  * Class PrinterURI is a printing attribute class, a URI, that specifies the
18  * globally unique name of a printer. If it has such a name, an administrator
19  * determines a printer's URI and sets this attribute to that name.
20  * <P>
21  * <B>IPP Compatibility:</B> This implements the
22  * IPP printer-uri attribute. The string form returned by
23  * <CODE>toString()</CODE> gives the IPP printer-uri value.
24  * The category name returned by <CODE>getName()</CODE>
25  * gives the IPP attribute name.
26  * <P>
27  *
28  * @author Robert Herriot
29  */

30
31 public final class PrinterURI extends URISyntax JavaDoc
32     implements PrintServiceAttribute JavaDoc {
33
34     private static final long serialVersionUID = 7923912792485606497L;
35
36     /**
37      * Constructs a new PrinterURI attribute with the specified URI.
38      *
39      * @param uri URI of the printer
40      *
41      * @exception NullPointerException
42      * (unchecked exception) Thrown if <CODE>uri</CODE> is null.
43      */

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

67     public boolean equals(Object JavaDoc object) {
68     return (super.equals(object) && object instanceof PrinterURI JavaDoc);
69     }
70
71    /**
72      * Get the printing attribute class which is to be used as the "category"
73      * for this printing attribute value.
74      * <P>
75      * For class PrinterURI and any vendor-defined subclasses, the category is
76      * class PrinterURI itself.
77      *
78      * @return Printing attribute class (category), an instance of class
79      * {@link java.lang.Class java.lang.Class}.
80      */

81     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
82     return PrinterURI JavaDoc.class;
83     }
84
85     /**
86      * Get the name of the category of which this attribute value is an
87      * instance.
88      * <P>
89      * For class PrinterURI and any vendor-defined subclasses, the category
90      * name is <CODE>"printer-uri"</CODE>.
91      *
92      * @return Attribute category name.
93      */

94     public final String JavaDoc getName() {
95     return "printer-uri";
96     }
97
98 }
99
Popular Tags