Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheets.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;2829import javax.print.attribute.Attribute;30import javax.print.attribute.IntegerSyntax;31import javax.print.attribute.PrintJobAttribute;32import javax.print.attribute.PrintRequestAttribute;3334/**35* Class {@code JobMediaSheets} is an integer valued printing attribute class36* that specifies the total number of media sheets to be produced for this job.37* <p>38* The {@code JobMediaSheets} attribute describes the size of the job. This39* attribute is not intended to be a counter; it is intended to be useful40* routing and scheduling information if known. The printer may try to compute41* the {@code JobMediaSheets} attribute's value if it is not supplied in the42* Print Request. Even if the client does supply a value for the43* {@code JobMediaSheets} attribute in the Print Request, the printer may choose44* to change the value if the printer is able to compute a value which is more45* accurate than the client supplied value. The printer may be able to determine46* the correct value for the {@code JobMediaSheets} attribute either right at47* job submission time or at any later point in time.48* <p>49* Unlike the {@link JobKOctets JobKOctets} and50* {@link JobImpressions JobImpressions} attributes, the {@code JobMediaSheets}51* value must include the multiplicative factors contributed by the number of52* copies specified by the {@link Copies Copies} attribute and a "number of53* copies" instruction embedded in the document data, if any. This difference54* allows the system administrator to control the lower and upper bounds of both55* (1) the size of the document(s) with56* {@link JobKOctetsSupported JobKOctetsSupported} and57* {@link JobImpressionsSupported JobImpressionsSupported} and (2) the size of58* the job with {@link JobMediaSheetsSupported JobMediaSheetsSupported}.59* <p>60* <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The61* category name returned by {@code getName()} gives the IPP attribute name.62*63* @author Alan Kaminsky64* @see JobMediaSheetsSupported65* @see JobMediaSheetsCompleted66* @see JobKOctets67* @see JobImpressions68*/69public class JobMediaSheets extends IntegerSyntax70implements PrintRequestAttribute, PrintJobAttribute {7172/**73* Use serialVersionUID from JDK 1.4 for interoperability.74*/75@Serial76private static final long serialVersionUID = 408871131531979741L;7778/**79* Construct a new job media sheets attribute with the given integer value.80*81* @param value Integer value82* @throws IllegalArgumentException if {@code value} is negative83*/84public JobMediaSheets(int value) {85super (value, 0, Integer.MAX_VALUE);86}8788/**89* Returns whether this job media sheets attribute is equivalent to the90* passed in object. To be equivalent, all of the following conditions must91* be true:92* <ol type=1>93* <li>{@code object} is not {@code null}.94* <li>{@code object} is an instance of class {@code JobMediaSheets}.95* <li>This job media sheets attribute's value and {@code object}'s value96* are equal.97* </ol>98*99* @param object {@code Object} to compare to100* @return {@code true} if {@code object} is equivalent to this job media101* sheets attribute, {@code false} otherwise102*/103public boolean equals(Object object) {104return super.equals(object) && object instanceof JobMediaSheets;105}106107/**108* Get the printing attribute class which is to be used as the "category"109* for this printing attribute value.110* <p>111* For class {@code JobMediaSheets} and any vendor-defined subclasses, the112* category is class {@code JobMediaSheets} itself.113*114* @return printing attribute class (category), an instance of class115* {@link Class java.lang.Class}116*/117public final Class<? extends Attribute> getCategory() {118return JobMediaSheets.class;119}120121/**122* Get the name of the category of which this attribute value is an123* instance.124* <p>125* For class {@code JobMediaSheets} and any vendor-defined subclasses, the126* category name is {@code "job-media-sheets"}.127*128* @return attribute category name129*/130public final String getName() {131return "job-media-sheets";132}133}134135136