KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)DateTimeAtCompleted.java 1.7 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.Date JavaDoc;
10 import javax.print.attribute.Attribute JavaDoc;
11 import javax.print.attribute.DateTimeSyntax JavaDoc;
12 import javax.print.attribute.PrintJobAttribute JavaDoc;
13
14 /**
15  * Class DateTimeAtCompleted is a printing attribute class, a date-time
16  * attribute, that indicates the date and time at which the Print Job completed
17  * (or was canceled or aborted).
18  * <P>
19  * To construct a DateTimeAtCompleted attribute from separate values of the
20  * year, month, day, hour, minute, and so on, use a {@link java.util.Calendar
21  * Calendar} object to construct a {@link java.util.Date Date} object, then use
22  * the {@link java.util.Date Date} object to construct the DateTimeAtCompleted
23  * attribute. To convert a DateTimeAtCompleted attribute to separate values of
24  * the year, month, day, hour, minute, and so on, create a {@link
25  * java.util.Calendar Calendar} object and set it to the {@link java.util.Date
26  * Date} from the DateTimeAtCompleted attribute.
27  * <P>
28  * <B>IPP Compatibility:</B> The information needed to construct an IPP
29  * "date-time-at-completed" attribute can be obtained as described above. The
30  * category name returned by <CODE>getName()</CODE> gives the IPP attribute
31  * name.
32  * <P>
33  *
34  * @author Alan Kaminsky
35  */

36 public final class DateTimeAtCompleted extends DateTimeSyntax JavaDoc
37     implements PrintJobAttribute JavaDoc {
38
39     private static final long serialVersionUID = 6497399708058490000L;
40
41     /**
42      * Construct a new date-time at completed attribute with the given {@link
43      * java.util.Date Date} value.
44      *
45      * @param dateTime {@link java.util.Date Date} value.
46      *
47      * @exception NullPointerException
48      * (unchecked exception) Thrown if <CODE>dateTime</CODE> is null.
49      */

50     public DateTimeAtCompleted(Date JavaDoc dateTime) {
51     super (dateTime);
52     }
53
54     /**
55      * Returns whether this date-time at completed attribute is equivalent to
56      * the passed in object. To be equivalent, all of the following conditions
57      * must be true:
58      * <OL TYPE=1>
59      * <LI>
60      * <CODE>object</CODE> is not null.
61      * <LI>
62      * <CODE>object</CODE> is an instance of class DateTimeAtCompleted.
63      * <LI>
64      * This date-time at completed attribute's {@link java.util.Date Date} value
65      * and <CODE>object</CODE>'s {@link java.util.Date Date} value are equal.
66      * </OL>
67      *
68      * @param object Object to compare to.
69      *
70      * @return True if <CODE>object</CODE> is equivalent to this date-time
71      * at completed attribute, false otherwise.
72      */

73     public boolean equals(Object JavaDoc object) {
74     return(super.equals (object) &&
75            object instanceof DateTimeAtCompleted JavaDoc);
76     }
77
78 // Exported operations inherited and implemented from interface Attribute.
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 DateTimeAtCompleted, the category is class
85      * DateTimeAtCompleted itself.
86      *
87      * @return Printing attribute class (category), an instance of class
88      * {@link java.lang.Class java.lang.Class}.
89      */

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

103     public final String JavaDoc getName() {
104     return "date-time-at-completed";
105     }
106     
107 }
108
Popular Tags