KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)PrinterLocation.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 PrinterLocation is a printing attribute class, a text attribute, that
17  * identifies the location of the device. This could include things like:
18  * <CODE>"in Room 123A, second floor of building XYZ"</CODE>.
19  * <P>
20  * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
21  * locale gives the IPP natural language. The category name returned by
22  * <CODE>getName()</CODE> gives the IPP attribute name.
23  * <P>
24  *
25  * @author Alan Kaminsky
26  */

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

44     public PrinterLocation(String JavaDoc location, Locale JavaDoc locale) {
45     super (location, locale);
46     }
47
48     /**
49      * Returns whether this printer location attribute is equivalent to the
50      * passed in object. To be equivalent, all of the following conditions
51      * must be 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 PrinterLocation.
57      * <LI>
58      * This printer location attribute's underlying string and
59      * <CODE>object</CODE>'s underlying string are equal.
60      * <LI>
61      * This printer location attribute's locale and <CODE>object</CODE>'s
62      * locale are equal.
63      * </OL>
64      *
65      * @param object Object to compare to.
66      *
67      * @return True if <CODE>object</CODE> is equivalent to this printer
68      * location attribute, false otherwise.
69      */

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

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

97     public final String JavaDoc getName() {
98     return "printer-location";
99     }
100
101 }
102
Popular Tags