KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)JobName.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.PrintRequestAttribute JavaDoc;
14 import javax.print.attribute.PrintJobAttribute JavaDoc;
15
16 /**
17  * Class JobName is a printing attribute class, a text attribute, that specifies
18  * the name of a print job. A job's name is an arbitrary string defined by the
19  * client. It does not need to be unique between different jobs. A Print Job's
20  * JobName attribute is set to the value supplied by the client in the Print
21  * Request's attribute set. If, however, the client does not supply a JobName
22  * attribute in the Print Request, the printer, when it creates the Print Job,
23  * must generate a JobName. The printer should generate the value of the Print
24  * Job's JobName attribute from the first of the following sources that produces
25  * a value: (1) the {@link DocumentName DocumentName} attribute of the first (or
26  * only) doc in the job, (2) the URL of the first (or only) doc in the job, if
27  * the doc's print data representation object is a URL, or (3) any other piece
28  * of Print Job specific and/or document content information.
29  * <P>
30  * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
31  * locale gives the IPP natural language. The category name returned by
32  * <CODE>getName()</CODE> gives the IPP attribute name.
33  * <P>
34  *
35  * @author Alan Kaminsky
36  */

37 public final class JobName extends TextSyntax JavaDoc
38     implements PrintRequestAttribute JavaDoc, PrintJobAttribute JavaDoc {
39
40     private static final long serialVersionUID = 4660359192078689545L;
41
42     /**
43      * Constructs a new job name attribute with the given job name and locale.
44      *
45      * @param jobName Job name.
46      * @param locale Natural language of the text string. null
47      * is interpreted to mean the default locale as returned
48      * by <code>Locale.getDefault()</code>
49      *
50      * @exception NullPointerException
51      * (unchecked exception) Thrown if <CODE>jobName</CODE> is null.
52      */

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

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

91     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
92     return JobName JavaDoc.class;
93     }
94
95     /**
96      * Get the name of the category of which this attribute value is an
97      * instance.
98      * <P>
99      * For class JobName, the category name is <CODE>"job-name"</CODE>.
100      *
101      * @return Attribute category name.
102      */

103     public final String JavaDoc getName() {
104     return "job-name";
105     }
106     
107 }
108
Popular Tags