001 /*
002 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.print.attribute.standard;
026
027 import java.util.Date;
028 import javax.print.attribute.Attribute;
029 import javax.print.attribute.DateTimeSyntax;
030 import javax.print.attribute.PrintJobAttribute;
031
032 /**
033 * Class DateTimeAtProcessing is a printing attribute class, a date-time
034 * attribute, that indicates the date and time at which the Print Job first
035 * began processing.
036 * <P>
037 * To construct a DateTimeAtProcessing attribute from separate values of the
038 * year, month, day, hour, minute, and so on, use a {@link java.util.Calendar
039 * Calendar} object to construct a {@link java.util.Date Date} object, then use
040 * the {@link java.util.Date Date} object to construct the DateTimeAtProcessing
041 * attribute. To convert a DateTimeAtProcessing attribute to separate values of
042 * the year, month, day, hour, minute, and so on, create a {@link
043 * java.util.Calendar Calendar} object and set it to the {@link java.util.Date
044 * Date} from the DateTimeAtProcessing attribute.
045 * <P>
046 * <B>IPP Compatibility:</B> The information needed to construct an IPP
047 * "date-time-at-processing" attribute can be obtained as described above. The
048 * category name returned by <CODE>getName()</CODE> gives the IPP attribute
049 * name.
050 * <P>
051 *
052 * @author Alan Kaminsky
053 */
054 public final class DateTimeAtProcessing extends DateTimeSyntax
055 implements PrintJobAttribute {
056
057 private static final long serialVersionUID = -3710068197278263244L;
058
059 /**
060 * Construct a new date-time at processing attribute with the given {@link
061 * java.util.Date Date} value.
062 *
063 * @param dateTime {@link java.util.Date Date} value.
064 *
065 * @exception NullPointerException
066 * (unchecked exception) Thrown if <CODE>dateTime</CODE> is null.
067 */
068 public DateTimeAtProcessing(Date dateTime) {
069 super (dateTime);
070 }
071
072 /**
073 * Returns whether this date-time at processing attribute is equivalent to
074 * the passed in object. To be equivalent, all of the following conditions
075 * must be true:
076 * <OL TYPE=1>
077 * <LI>
078 * <CODE>object</CODE> is not null.
079 * <LI>
080 * <CODE>object</CODE> is an instance of class DateTimeAtProcessing.
081 * <LI>
082 * This date-time at processing attribute's {@link java.util.Date Date}
083 * value and <CODE>object</CODE>'s {@link java.util.Date Date} value
084 * are equal.
085 * </OL>
086 *
087 * @param object Object to compare to.
088 *
089 * @return True if <CODE>object</CODE> is equivalent to this date-time
090 * at processing attribute, false otherwise.
091 */
092 public boolean equals(Object object) {
093 return (super .equals(object) && object instanceof DateTimeAtProcessing);
094 }
095
096 /**
097 * Get the printing attribute class which is to be used as the "category"
098 * for this printing attribute value.
099 * <P>
100 * For class DateTimeAtProcessing, the category is class
101 * DateTimeAtProcessing itself.
102 *
103 * @return Printing attribute class (category), an instance of class
104 * {@link java.lang.Class java.lang.Class}.
105 */
106 public final Class<? extends Attribute> getCategory() {
107 return DateTimeAtProcessing.class;
108 }
109
110 /**
111 * Get the name of the category of which this attribute value is an
112 * instance.
113 * <P>
114 * For class DateTimeAtProcessing, the category name is
115 * <CODE>"date-time-at-processing"</CODE>.
116 *
117 * @return Attribute category name.
118 */
119 public final String getName() {
120 return "date-time-at-processing";
121 }
122
123 }
|