Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/NumberOfDocuments.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 javax.print.attribute.Attribute;27import javax.print.attribute.IntegerSyntax;28import javax.print.attribute.PrintJobAttribute;2930/**31* Class NumberOfDocuments is an integer valued printing attribute that32* indicates the number of individual docs the printer has accepted for this33* job, regardless of whether the docs' print data has reached the printer or34* not.35* <P>36* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The37* category name returned by <CODE>getName()</CODE> gives the IPP attribute38* name.39* <P>40*41* @author Alan Kaminsky42*/43public final class NumberOfDocuments extends IntegerSyntax44implements PrintJobAttribute {4546private static final long serialVersionUID = 7891881310684461097L;474849/**50* Construct a new number of documents attribute with the given integer51* value.52*53* @param value Integer value.54*55* @exception IllegalArgumentException56* (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.57*/58public NumberOfDocuments(int value) {59super (value, 0, Integer.MAX_VALUE);60}6162/**63* Returns whether this number of documents attribute is equivalent to the64* passed in object. To be equivalent, all of the following conditions65* must be true:66* <OL TYPE=1>67* <LI>68* <CODE>object</CODE> is not null.69* <LI>70* <CODE>object</CODE> is an instance of class NumberOfDocuments.71* <LI>72* This number of documents attribute's value and <CODE>object</CODE>'s73* value are equal.74* </OL>75*76* @param object Object to compare to.77*78* @return True if <CODE>object</CODE> is equivalent to this number of79* documents attribute, false otherwise.80*/81public boolean equals(Object object) {82return (super.equals (object) &&83object instanceof NumberOfDocuments);84}8586/**87* Get the printing attribute class which is to be used as the "category"88* for this printing attribute value.89* <P>90* For class NumberOfDocuments, the91* category is class NumberOfDocuments itself.92*93* @return Printing attribute class (category), an instance of class94* {@link java.lang.Class java.lang.Class}.95*/96public final Class<? extends Attribute> getCategory() {97return NumberOfDocuments.class;98}99100/**101* Get the name of the category of which this attribute value is an102* instance.103* <P>104* For class NumberOfDocuments, the105* category name is <CODE>"number-of-documents"</CODE>.106*107* @return Attribute category name.108*/109public final String getName() {110return "number-of-documents";111}112113}114115116