blob: 0d7dec34927d2ad19c8fe24109164f41725547ff [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2001-2004 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25package javax.print.attribute.standard;
26
27import java.net.URI;
28import java.util.Locale;
29
30import javax.print.attribute.Attribute;
31import javax.print.attribute.URISyntax;
32import javax.print.attribute.PrintServiceAttribute;
33
34/**
35 * Class PrinterURI is a printing attribute class, a URI, that specifies the
36 * globally unique name of a printer. If it has such a name, an administrator
37 * determines a printer's URI and sets this attribute to that name.
38 * <P>
39 * <B>IPP Compatibility:</B> This implements the
40 * IPP printer-uri attribute. The string form returned by
41 * <CODE>toString()</CODE> gives the IPP printer-uri value.
42 * The category name returned by <CODE>getName()</CODE>
43 * gives the IPP attribute name.
44 * <P>
45 *
46 * @author Robert Herriot
47 */
48
49public final class PrinterURI extends URISyntax
50 implements PrintServiceAttribute {
51
52 private static final long serialVersionUID = 7923912792485606497L;
53
54 /**
55 * Constructs a new PrinterURI attribute with the specified URI.
56 *
57 * @param uri URI of the printer
58 *
59 * @exception NullPointerException
60 * (unchecked exception) Thrown if <CODE>uri</CODE> is null.
61 */
62 public PrinterURI(URI uri) {
63 super (uri);
64 }
65
66 /**
67 * Returns whether this printer name attribute is equivalent to the passed
68 * in object. To be equivalent, all of the following conditions must be
69 * true:
70 * <OL TYPE=1>
71 * <LI>
72 * <CODE>object</CODE> is not null.
73 * <LI>
74 * <CODE>object</CODE> is an instance of class PrinterURI.
75 * <LI>
76 * This PrinterURI attribute's underlying URI and
77 * <CODE>object</CODE>'s underlying URI are equal.
78 * </OL>
79 *
80 * @param object Object to compare to.
81 *
82 * @return True if <CODE>object</CODE> is equivalent to this PrinterURI
83 * attribute, false otherwise.
84 */
85 public boolean equals(Object object) {
86 return (super.equals(object) && object instanceof PrinterURI);
87 }
88
89 /**
90 * Get the printing attribute class which is to be used as the "category"
91 * for this printing attribute value.
92 * <P>
93 * For class PrinterURI and any vendor-defined subclasses, the category is
94 * class PrinterURI itself.
95 *
96 * @return Printing attribute class (category), an instance of class
97 * {@link java.lang.Class java.lang.Class}.
98 */
99 public final Class<? extends Attribute> getCategory() {
100 return PrinterURI.class;
101 }
102
103 /**
104 * Get the name of the category of which this attribute value is an
105 * instance.
106 * <P>
107 * For class PrinterURI and any vendor-defined subclasses, the category
108 * name is <CODE>"printer-uri"</CODE>.
109 *
110 * @return Attribute category name.
111 */
112 public final String getName() {
113 return "printer-uri";
114 }
115
116}