KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)PrinterMakeAndModel.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 import javax.print.attribute.Attribute JavaDoc;
11 import javax.print.attribute.TextSyntax JavaDoc;
12 import javax.print.attribute.PrintServiceAttribute JavaDoc;
13
14 /**
15  * Class PrinterMakeAndModel is a printing attribute class, a text attribute,
16  * that the make and model of the printer.
17  * <P>
18  * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
19  * locale gives the IPP natural language. The category name returned by
20  * <CODE>getName()</CODE> gives the IPP attribute name.
21  * <P>
22  *
23  * @author Alan Kaminsky
24  */

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

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

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

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

96     public final String JavaDoc getName() {
97     return "printer-make-and-model";
98     }
99
100 }
101
Popular Tags