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