KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)DateTimeAtCreation.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 DateTimeAtCreation is a printing attribute class, a date-time
16  * attribute, that indicates the date and time at which the Print Job was
17  * created.
18  * <P>
19  * To construct a DateTimeAtCreation attribute from separate values of the year,
20  * 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 DateTimeAtCreation
23  * attribute. To convert a DateTimeAtCreation 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 DateTimeAtCreation attribute.
27  * <P>
28  * <B>IPP Compatibility:</B> The information needed to construct an IPP
29  * "date-time-at-creation" 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 DateTimeAtCreation extends DateTimeSyntax JavaDoc
37     implements PrintJobAttribute JavaDoc {
38
39     private static final long serialVersionUID = -2923732231056647903L;
40
41     /**
42      * Construct a new date-time at creation 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 DateTimeAtCreation(Date JavaDoc dateTime) {
51     super (dateTime);
52     }
53
54     /**
55      * Returns whether this date-time at creation 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 DateTimeAtCreation.
63      * <LI>
64      * This date-time at creation 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 creation attribute, false otherwise.
72      */

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

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

101     public final String JavaDoc getName() {
102     return "date-time-at-creation";
103     }
104     
105 }
106
Popular Tags