1. /*
  2. * @(#)JobMessageFromOperator.java 1.9 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 java.util.Locale;
  9. import javax.print.attribute.Attribute;
  10. import javax.print.attribute.TextSyntax;
  11. import javax.print.attribute.PrintJobAttribute;
  12. /**
  13. * Class JobMessageFromOperator is a printing attribute class, a text attribute,
  14. * that provides a message from an operator, system administrator, or
  15. * "intelligent" process to indicate to the end user the reasons for
  16. * modification or other management action taken on a job.
  17. * <P>
  18. * A Print Job's attribute set includes zero instances or one instance of a
  19. * JobMessageFromOperator attribute, not more than one instance. A new
  20. * JobMessageFromOperator attribute replaces an existing JobMessageFromOperator
  21. * attribute, if any. In other words, JobMessageFromOperator is not intended to
  22. * be a history log. If it wishes, the client can detect changes to a Print
  23. * Job's JobMessageFromOperator attribute and maintain the client's own history
  24. * log of the JobMessageFromOperator attribute values.
  25. * <P>
  26. * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
  27. * locale gives the IPP natural language. The category name returned by
  28. * <CODE>getName()</CODE> gives the IPP attribute name.
  29. * <P>
  30. *
  31. * @author Alan Kaminsky
  32. */
  33. public final class JobMessageFromOperator extends TextSyntax
  34. implements PrintJobAttribute {
  35. private static final long serialVersionUID = -4620751846003142047L;
  36. /**
  37. * Constructs a new job message from operator attribute with the given
  38. * message and locale.
  39. *
  40. * @param message Message.
  41. * @param locale Natural language of the text string. null
  42. * is interpreted to mean the default locale as returned
  43. * by <code>Locale.getDefault()</code>
  44. *
  45. * @exception NullPointerException
  46. * (unchecked exception) Thrown if <CODE>message</CODE> is null.
  47. */
  48. public JobMessageFromOperator(String message, Locale locale) {
  49. super (message, locale);
  50. }
  51. /**
  52. * Returns whether this job message from operator attribute is equivalent to
  53. * the passed in object. To be equivalent, all of the following conditions
  54. * must be true:
  55. * <OL TYPE=1>
  56. * <LI>
  57. * <CODE>object</CODE> is not null.
  58. * <LI>
  59. * <CODE>object</CODE> is an instance of class JobMessageFromOperator.
  60. * <LI>
  61. * This job message from operator attribute's underlying string and
  62. * <CODE>object</CODE>'s underlying string are equal.
  63. * <LI>
  64. * This job message from operator attribute's locale and
  65. * <CODE>object</CODE>'s locale are equal.
  66. * </OL>
  67. *
  68. * @param object Object to compare to.
  69. *
  70. * @return True if <CODE>object</CODE> is equivalent to this job
  71. * message from operator attribute, false otherwise.
  72. */
  73. public boolean equals(Object object) {
  74. return (super.equals (object) &&
  75. object instanceof JobMessageFromOperator);
  76. }
  77. /**
  78. * Get the printing attribute class which is to be used as the "category"
  79. * for this printing attribute value.
  80. * <P>
  81. * For class JobMessageFromOperator, the
  82. * category is class JobMessageFromOperator itself.
  83. *
  84. * @return Printing attribute class (category), an instance of class
  85. * {@link java.lang.Class java.lang.Class}.
  86. */
  87. public final Class<? extends Attribute> getCategory() {
  88. return JobMessageFromOperator.class;
  89. }
  90. /**
  91. * Get the name of the category of which this attribute value is an
  92. * instance.
  93. * <P>
  94. * For class JobMessageFromOperator, the
  95. * category name is <CODE>"job-message-from-operator"</CODE>.
  96. *
  97. * @return Attribute category name.
  98. */
  99. public final String getName() {
  100. return "job-message-from-operator";
  101. }
  102. }