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