Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/NumberOfDocuments.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;3233/**34* Class {@code NumberOfDocuments} is an integer valued printing attribute that35* indicates the number of individual docs the printer has accepted for this36* job, regardless of whether the docs' print data has reached the printer or37* not.38* <p>39* <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The40* category name returned by {@code getName()} gives the IPP attribute name.41*42* @author Alan Kaminsky43*/44public final class NumberOfDocuments extends IntegerSyntax45implements PrintJobAttribute {4647/**48* Use serialVersionUID from JDK 1.4 for interoperability.49*/50@Serial51private static final long serialVersionUID = 7891881310684461097L;5253/**54* Construct a new number of documents attribute with the given integer55* value.56*57* @param value Integer value58* @throws IllegalArgumentException if {@code value} is negative59*/60public NumberOfDocuments(int value) {61super (value, 0, Integer.MAX_VALUE);62}6364/**65* Returns whether this number of documents attribute is equivalent to the66* passed in object. To be equivalent, all of the following conditions must67* be true:68* <ol type=1>69* <li>{@code object} is not {@code null}.70* <li>{@code object} is an instance of class {@code NumberOfDocuments}.71* <li>This number of documents attribute's value and {@code object}'s72* value are equal.73* </ol>74*75* @param object {@code Object} to compare to76* @return {@code true} if {@code object} is equivalent to this number of77* documents attribute, {@code false} otherwise78*/79public boolean equals(Object object) {80return (super.equals (object) &&81object instanceof NumberOfDocuments);82}8384/**85* Get the printing attribute class which is to be used as the "category"86* for this printing attribute value.87* <p>88* For class {@code NumberOfDocuments}, the category is class89* {@code NumberOfDocuments} itself.90*91* @return printing attribute class (category), an instance of class92* {@link Class java.lang.Class}93*/94public final Class<? extends Attribute> getCategory() {95return NumberOfDocuments.class;96}9798/**99* Get the name of the category of which this attribute value is an100* instance.101* <p>102* For class {@code NumberOfDocuments}, the category name is103* {@code "number-of-documents"}.104*105* @return attribute category name106*/107public final String getName() {108return "number-of-documents";109}110}111112113