1 /* 2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.print.attribute.standard; 27 28 import javax.print.attribute.Attribute; 29 import javax.print.attribute.IntegerSyntax; 30 import javax.print.attribute.SupportedValuesAttribute; 31 32 /** 33 * Class {@code JobPrioritySupported} is an integer valued printing attribute 34 * class that specifies whether a Print Service instance supports the 35 * {@link JobPriority JobPriority} attribute and the number of different job 36 * priority levels supported. 37 * <p> 38 * The client can always specify any {@link JobPriority JobPriority} value from 39 * 1 to 100 for a job. However, the Print Service instance may support fewer 40 * than 100 different job priority levels. If this is the case, the Print 41 * Service instance automatically maps the client-specified job priority value 42 * to one of the supported job priority levels, dividing the 100 job priority 43 * values equally among the available job priority levels. 44 * <p> 45 * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The 46 * category name returned by {@code getName()} gives the IPP attribute name. 47 * 48 * @author Alan Kaminsky 49 */ 50 public final class JobPrioritySupported extends IntegerSyntax 51 implements SupportedValuesAttribute { 52 53 /** 54 * Use serialVersionUID from JDK 1.4 for interoperability. 55 */ 56 private static final long serialVersionUID = 2564840378013555894L; 57 58 /** 59 * Construct a new job priority supported attribute with the given integer 60 * value. 61 * 62 * @param value number of different job priority levels supported 63 * @throws IllegalArgumentException if {@code value} is less than 1 or 64 * greater than 100 65 */ 66 public JobPrioritySupported(int value) { 67 super (value, 1, 100); 68 } 69 70 /** 71 * Returns whether this job priority supported attribute is equivalent to 72 * the passed in object. To be equivalent, all of the following conditions 73 * must be true: 74 * <ol type=1> 75 * <li>{@code object} is not {@code null}. 76 * <li>{@code object} is an instance of class 77 * {@code JobPrioritySupported}. 78 * <li>This job priority supported attribute's value and {@code object}'s 79 * value are equal. 80 * </ol> 81 * 82 * @param object {@code Object} to compare to 83 * @return {@code true} if {@code object} is equivalent to this job priority 84 * supported attribute, {@code false} otherwise 85 */ 86 public boolean equals (Object object) { 87 88 return (super.equals(object) && 89 object instanceof JobPrioritySupported); 90 } 91 92 /** 93 * Get the printing attribute class which is to be used as the "category" 94 * for this printing attribute value. 95 * <p> 96 * For class {@code JobPrioritySupported}, the category is class 97 * {@code JobPrioritySupported} itself. 98 * 99 * @return printing attribute class (category), an instance of class 100 * {@link Class java.lang.Class} 101 */ 102 public final Class<? extends Attribute> getCategory() { 103 return JobPrioritySupported.class; 104 } 105 106 /** 107 * Get the name of the category of which this attribute value is an 108 * instance. 109 * <p> 110 * For class {@code JobPrioritySupported}, the category name is 111 * {@code "job-priority-supported"}. 112 * 113 * @return attribute category name 114 */ 115 public final String getName() { 116 return "job-priority-supported"; 117 } 118 }