KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)Destination.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.net.URI JavaDoc;
10
11 import javax.print.attribute.Attribute JavaDoc;
12 import javax.print.attribute.URISyntax JavaDoc;
13 import javax.print.attribute.PrintRequestAttribute JavaDoc;
14 import javax.print.attribute.PrintJobAttribute JavaDoc;
15
16 /**
17  * Class Destination is a printing attribute class, a URI, that is used to
18  * indicate an alternate destination for the spooled printer formatted
19  * data. Many PrintServices will not support the notion of a destination
20  * other than the printer device, and so will not support this attribute.
21  * <p>
22  * A common use for this attribute will be applications which want
23  * to redirect output to a local disk file : eg."file:out.prn".
24  * Note that proper construction of "file:" scheme URI instances should
25  * be performed using the <code>toURI()</code> method of class
26  * {@link java.io.File File}.
27  * See the documentation on that class for more information.
28  * <p>
29  * If a destination URI is specified in a PrintRequest and it is not
30  * accessible for output by the PrintService, a PrintException will be thrown.
31  * The PrintException may implement URIException to provide a more specific
32  * cause.
33  * <P>
34  * <B>IPP Compatibility:</B> Destination is not an IPP attribute.
35  * <P>
36  *
37  * @author Phil Race.
38  */

39 public final class Destination extends URISyntax JavaDoc
40     implements PrintJobAttribute JavaDoc, PrintRequestAttribute JavaDoc {
41
42     private static final long serialVersionUID = 6776739171700415321L;
43
44     /**
45      * Constructs a new destination attribute with the specified URI.
46      *
47      * @param uri URI.
48      *
49      * @exception NullPointerException
50      * (unchecked exception) Thrown if <CODE>uri</CODE> is null.
51      */

52     public Destination(URI JavaDoc uri) {
53     super (uri);
54     }
55
56     /**
57      * Returns whether this destination attribute is equivalent to the
58      * passed in object. To be equivalent, all of the following conditions
59      * 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 Destination.
65      * <LI>
66      * This destination attribute's URI and <CODE>object</CODE>'s URI
67      * are equal.
68      * </OL>
69      *
70      * @param object Object to compare to.
71      *
72      * @return True if <CODE>object</CODE> is equivalent to this destination
73      * attribute, false otherwise.
74      */

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

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

101     public final String JavaDoc getName() {
102     return "spool-data-destination";
103     }
104
105 }
106
Popular Tags