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 DateTimeAtCompleted is a printing attribute class, a date-time
034 * attribute, that indicates the date and time at which the Print Job completed
035 * (or was canceled or aborted).
036 * <P>
037 * To construct a DateTimeAtCompleted 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 DateTimeAtCompleted
041 * attribute. To convert a DateTimeAtCompleted 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 DateTimeAtCompleted attribute.
045 * <P>
046 * <B>IPP Compatibility:</B> The information needed to construct an IPP
047 * "date-time-at-completed" 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 DateTimeAtCompleted extends DateTimeSyntax implements
055 PrintJobAttribute {
056
057 private static final long serialVersionUID = 6497399708058490000L;
058
059 /**
060 * Construct a new date-time at completed 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 DateTimeAtCompleted(Date dateTime) {
069 super (dateTime);
070 }
071
072 /**
073 * Returns whether this date-time at completed 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 DateTimeAtCompleted.
081 * <LI>
082 * This date-time at completed attribute's {@link java.util.Date Date} value
083 * and <CODE>object</CODE>'s {@link java.util.Date Date} value are equal.
084 * </OL>
085 *
086 * @param object Object to compare to.
087 *
088 * @return True if <CODE>object</CODE> is equivalent to this date-time
089 * at completed attribute, false otherwise.
090 */
091 public boolean equals(Object object) {
092 return (super .equals(object) && object instanceof DateTimeAtCompleted);
093 }
094
095 // Exported operations inherited and implemented from interface Attribute.
096
097 /**
098 * Get the printing attribute class which is to be used as the "category"
099 * for this printing attribute value.
100 * <P>
101 * For class DateTimeAtCompleted, the category is class
102 * DateTimeAtCompleted 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 DateTimeAtCompleted.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 DateTimeAtCompleted, the category name is
116 * <CODE>"date-time-at-completed"</CODE>.
117 *
118 * @return Attribute category name.
119 */
120 public final String getName() {
121 return "date-time-at-completed";
122 }
123
124 }
|