Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/DateTimeAtCreation.java
38918 views
/*1* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package javax.print.attribute.standard;2526import java.util.Date;27import javax.print.attribute.Attribute;28import javax.print.attribute.DateTimeSyntax;29import javax.print.attribute.PrintJobAttribute;3031/**32* Class DateTimeAtCreation is a printing attribute class, a date-time33* attribute, that indicates the date and time at which the Print Job was34* created.35* <P>36* To construct a DateTimeAtCreation attribute from separate values of the year,37* month, day, hour, minute, and so on, use a {@link java.util.Calendar38* Calendar} object to construct a {@link java.util.Date Date} object, then use39* the {@link java.util.Date Date} object to construct the DateTimeAtCreation40* attribute. To convert a DateTimeAtCreation attribute to separate values of41* the year, month, day, hour, minute, and so on, create a {@link42* java.util.Calendar Calendar} object and set it to the {@link java.util.Date43* Date} from the DateTimeAtCreation attribute.44* <P>45* <B>IPP Compatibility:</B> The information needed to construct an IPP46* "date-time-at-creation" attribute can be obtained as described above. The47* category name returned by <CODE>getName()</CODE> gives the IPP attribute48* name.49* <P>50*51* @author Alan Kaminsky52*/53public final class DateTimeAtCreation extends DateTimeSyntax54implements PrintJobAttribute {5556private static final long serialVersionUID = -2923732231056647903L;5758/**59* Construct a new date-time at creation attribute with the given {@link60* java.util.Date Date} value.61*62* @param dateTime {@link java.util.Date Date} value.63*64* @exception NullPointerException65* (unchecked exception) Thrown if <CODE>dateTime</CODE> is null.66*/67public DateTimeAtCreation(Date dateTime) {68super (dateTime);69}7071/**72* Returns whether this date-time at creation attribute is equivalent to73* the passed in object. To be equivalent, all of the following conditions74* must be true:75* <OL TYPE=1>76* <LI>77* <CODE>object</CODE> is not null.78* <LI>79* <CODE>object</CODE> is an instance of class DateTimeAtCreation.80* <LI>81* This date-time at creation attribute's {@link java.util.Date Date} value82* and <CODE>object</CODE>'s {@link java.util.Date Date} value are equal.83* </OL>84*85* @param object Object to compare to.86*87* @return True if <CODE>object</CODE> is equivalent to this date-time88* at creation attribute, false otherwise.89*/90public boolean equals(Object object) {91return(super.equals (object) &&92object instanceof DateTimeAtCreation);93}9495/**96* Get the printing attribute class which is to be used as the "category"97* for this printing attribute value.98* <P>99* For class DateTimeAtCreation, the category is class100* DateTimeAtCreation itself.101*102* @return Printing attribute class (category), an instance of class103* {@link java.lang.Class java.lang.Class}.104*/105public final Class<? extends Attribute> getCategory() {106return DateTimeAtCreation.class;107}108109/**110* Get the name of the category of which this attribute value is an111* instance.112* <P>113* For class DateTimeAtCreation, the category name is114* <CODE>"date-time-at-creation"</CODE>.115*116* @return Attribute category name.117*/118public final String getName() {119return "date-time-at-creation";120}121122}123124125