Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtProcessing.java
41171 views
/*1* Copyright (c) 2000, 2021, 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*/2425package javax.print.attribute.standard;2627import java.io.Serial;28import java.util.Calendar;29import java.util.Date;3031import javax.print.attribute.Attribute;32import javax.print.attribute.DateTimeSyntax;33import javax.print.attribute.PrintJobAttribute;3435/**36* Class {@code DateTimeAtProcessing} is a printing attribute class, a date-time37* attribute, that indicates the date and time at which the Print Job first38* began processing.39* <p>40* To construct a {@code DateTimeAtProcessing} attribute from separate values of41* the year, month, day, hour, minute, and so on, use a42* {@link Calendar Calendar} object to construct a {@link Date Date} object,43* then use the {@link Date Date} object to construct the DateTimeAtProcessing44* attribute. To convert a {@code DateTimeAtProcessing} attribute to separate45* values of the year, month, day, hour, minute, and so on, create a46* {@link Calendar Calendar} object and set it to the {@link Date Date} from the47* {@code DateTimeAtProcessing} attribute.48* <p>49* <b>IPP Compatibility:</b> The information needed to construct an IPP50* "date-time-at-processing" attribute can be obtained as described above. The51* category name returned by {@code getName()} gives the IPP attribute name.52*53* @author Alan Kaminsky54*/55public final class DateTimeAtProcessing extends DateTimeSyntax56implements PrintJobAttribute {5758/**59* Use serialVersionUID from JDK 1.4 for interoperability.60*/61@Serial62private static final long serialVersionUID = -3710068197278263244L;6364/**65* Construct a new date-time at processing attribute with the given66* {@link Date Date} value.67*68* @param dateTime {@link Date Date} value69* @throws NullPointerException if {@code dateTime} is {@code null}70*/71public DateTimeAtProcessing(Date dateTime) {72super (dateTime);73}7475/**76* Returns whether this date-time at processing attribute is equivalent to77* the passed in object. To be equivalent, all of the following conditions78* must be true:79* <ol type=1>80* <li>{@code object} is not {@code null}.81* <li>{@code object} is an instance of class82* {@code DateTimeAtProcessing}.83* <li>This date-time at processing attribute's {@link Date Date}84* value and {@code object}'s {@link Date Date} value are equal.85* </ol>86*87* @param object {@code Object} to compare to88* @return {@code true} if {@code object} is equivalent to this date-time at89* processing attribute, {@code false} otherwise90*/91public boolean equals(Object object) {92return(super.equals (object) &&93object instanceof DateTimeAtProcessing);94}9596/**97* Get the printing attribute class which is to be used as the "category"98* for this printing attribute value.99* <p>100* For class {@code DateTimeAtProcessing}, the category is class101* {@code DateTimeAtProcessing} itself.102*103* @return printing attribute class (category), an instance of class104* {@link Class java.lang.Class}105*/106public final Class<? extends Attribute> getCategory() {107return DateTimeAtProcessing.class;108}109110/**111* Get the name of the category of which this attribute value is an112* instance.113* <p>114* For class {@code DateTimeAtProcessing}, the category name is115* {@code "date-time-at-processing"}.116*117* @return attribute category name118*/119public final String getName() {120return "date-time-at-processing";121}122}123124125