blob: 3455b998a72ee05493c0099687d8d571b6106ef9 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25package javax.print.attribute.standard;
26
27import java.util.Date;
28import javax.print.attribute.Attribute;
29import javax.print.attribute.DateTimeSyntax;
30import javax.print.attribute.PrintJobAttribute;
31
32/**
33 * Class DateTimeAtProcessing is a printing attribute class, a date-time
34 * attribute, that indicates the date and time at which the Print Job first
35 * began processing.
36 * <P>
37 * To construct a DateTimeAtProcessing attribute from separate values of the
38 * year, month, day, hour, minute, and so on, use a {@link java.util.Calendar
39 * Calendar} object to construct a {@link java.util.Date Date} object, then use
40 * the {@link java.util.Date Date} object to construct the DateTimeAtProcessing
41 * attribute. To convert a DateTimeAtProcessing attribute to separate values of
42 * the year, month, day, hour, minute, and so on, create a {@link
43 * java.util.Calendar Calendar} object and set it to the {@link java.util.Date
44 * Date} from the DateTimeAtProcessing attribute.
45 * <P>
46 * <B>IPP Compatibility:</B> The information needed to construct an IPP
47 * "date-time-at-processing" attribute can be obtained as described above. The
48 * category name returned by <CODE>getName()</CODE> gives the IPP attribute
49 * name.
50 * <P>
51 *
52 * @author Alan Kaminsky
53 */
54public final class DateTimeAtProcessing extends DateTimeSyntax
55 implements PrintJobAttribute {
56
57 private static final long serialVersionUID = -3710068197278263244L;
58
59 /**
60 * Construct a new date-time at processing attribute with the given {@link
61 * java.util.Date Date} value.
62 *
63 * @param dateTime {@link java.util.Date Date} value.
64 *
65 * @exception NullPointerException
66 * (unchecked exception) Thrown if <CODE>dateTime</CODE> is null.
67 */
68 public DateTimeAtProcessing(Date dateTime) {
69 super (dateTime);
70 }
71
72 /**
73 * Returns whether this date-time at processing attribute is equivalent to
74 * the passed in object. To be equivalent, all of the following conditions
75 * must be true:
76 * <OL TYPE=1>
77 * <LI>
78 * <CODE>object</CODE> is not null.
79 * <LI>
80 * <CODE>object</CODE> is an instance of class DateTimeAtProcessing.
81 * <LI>
82 * This date-time at processing attribute's {@link java.util.Date Date}
83 * value and <CODE>object</CODE>'s {@link java.util.Date Date} value
84 * are equal.
85 * </OL>
86 *
87 * @param object Object to compare to.
88 *
89 * @return True if <CODE>object</CODE> is equivalent to this date-time
90 * at processing attribute, false otherwise.
91 */
92 public boolean equals(Object object) {
93 return(super.equals (object) &&
94 object instanceof DateTimeAtProcessing);
95 }
96
97 /**
98 * Get the printing attribute class which is to be used as the "category"
99 * for this printing attribute value.
100 * <P>
101 * For class DateTimeAtProcessing, the category is class
102 * DateTimeAtProcessing itself.
103 *
104 * @return Printing attribute class (category), an instance of class
105 * {@link java.lang.Class java.lang.Class}.
106 */
107 public final Class<? extends Attribute> getCategory() {
108 return DateTimeAtProcessing.class;
109 }
110
111 /**
112 * Get the name of the category of which this attribute value is an
113 * instance.
114 * <P>
115 * For class DateTimeAtProcessing, the category name is
116 * <CODE>"date-time-at-processing"</CODE>.
117 *
118 * @return Attribute category name.
119 */
120 public final String getName() {
121 return "date-time-at-processing";
122 }
123
124}