1. /*
  2. * @(#)JobPrioritySupported.java 1.7 04/05/05
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.print.attribute.standard;
  8. import javax.print.attribute.Attribute;
  9. import javax.print.attribute.IntegerSyntax;
  10. import javax.print.attribute.SupportedValuesAttribute;
  11. /**
  12. * Class JobPrioritySupported is an integer valued printing attribute class
  13. * that specifies whether a Print Service instance supports the {@link
  14. * JobPriority JobPriority} attribute and the number of different job priority
  15. * levels supported.
  16. * <P>
  17. * The client can always specify any {@link JobPriority JobPriority} value
  18. * from 1 to 100 for a job. However, the Print Service instance may support
  19. * fewer than 100 different job priority levels. If this is the case, the
  20. * Print Service instance automatically maps the client-specified job priority
  21. * value to one of the supported job priority levels, dividing the 100 job
  22. * priority values equally among the available job priority levels.
  23. * <P>
  24. * <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
  25. * The category name returned by <CODE>getName()</CODE> gives the IPP
  26. * attribute name.
  27. * <P>
  28. *
  29. * @author Alan Kaminsky
  30. */
  31. public final class JobPrioritySupported extends IntegerSyntax
  32. implements SupportedValuesAttribute {
  33. private static final long serialVersionUID = 2564840378013555894L;
  34. /**
  35. * Construct a new job priority supported attribute with the given integer
  36. * value.
  37. *
  38. * @param value Number of different job priority levels supported.
  39. *
  40. * @exception IllegalArgumentException
  41. * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1
  42. * or greater than 100.
  43. */
  44. public JobPrioritySupported(int value) {
  45. super (value, 1, 100);
  46. }
  47. /**
  48. * Returns whether this job priority supported attribute is equivalent to
  49. * the passed in object. To be equivalent, all of the following conditions
  50. * must be true:
  51. * <OL TYPE=1>
  52. * <LI>
  53. * <CODE>object</CODE> is not null.
  54. * <LI>
  55. * <CODE>object</CODE> is an instance of class JobPrioritySupported.
  56. * <LI>
  57. * This job priority supported attribute's value and
  58. * <CODE>object</CODE>'s value are equal.
  59. * </OL>
  60. *
  61. * @param object Object to compare to.
  62. *
  63. * @return True if <CODE>object</CODE> is equivalent to this job
  64. * priority supported attribute, false otherwise.
  65. */
  66. public boolean equals (Object object) {
  67. return (super.equals(object) &&
  68. object instanceof JobPrioritySupported);
  69. }
  70. /**
  71. * Get the printing attribute class which is to be used as the "category"
  72. * for this printing attribute value.
  73. * <P>
  74. * For class JobPrioritySupported, the
  75. * category is class JobPrioritySupported itself.
  76. *
  77. * @return Printing attribute class (category), an instance of class
  78. * {@link java.lang.Class java.lang.Class}.
  79. */
  80. public final Class<? extends Attribute> getCategory() {
  81. return JobPrioritySupported.class;
  82. }
  83. /**
  84. * Get the name of the category of which this attribute value is an
  85. * instance.
  86. * <P>
  87. * For class JobPrioritySupported, the
  88. * category name is <CODE>"job-priority-supported"</CODE>.
  89. *
  90. * @return Attribute category name.
  91. */
  92. public final String getName() {
  93. return "job-priority-supported";
  94. }
  95. }