1. /*
  2. * @(#)PrinterInfo.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 PrinterInfo is a printing attribute class, a text attribute, that
  13. * provides descriptive information about a printer. This could include things
  14. * like: <CODE>"This printer can be used for printing color transparencies for
  15. * HR presentations"</CODE>, or <CODE>"Out of courtesy for others, please
  16. * print only small (1-5 page) jobs at this printer"</CODE>, or even \
  17. * <CODE>"This printer is going away on July 1, 1997, please find a new
  18. * printer"</CODE>.
  19. * <P>
  20. * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
  21. * locale gives the IPP natural language. The category name returned by
  22. * <CODE>getName()</CODE> gives the IPP attribute name.
  23. * <P>
  24. *
  25. * @author Alan Kaminsky
  26. */
  27. public final class PrinterInfo extends TextSyntax
  28. implements PrintServiceAttribute {
  29. /**
  30. * Constructs a new printer info attribute with the given information
  31. * string and locale.
  32. *
  33. * @param info Printer information string.
  34. * @param locale Natural language of the text string. null
  35. * is interpreted to mean the default locale as returned
  36. * by <code>Locale.getDefault()</code>
  37. *
  38. * @exception NullPointerException
  39. * (unchecked exception) Thrown if <CODE>info</CODE> is null.
  40. */
  41. public PrinterInfo(String info, Locale locale) {
  42. super (info, locale);
  43. }
  44. /**
  45. * Returns whether this printer info attribute is equivalent to the passed
  46. * in object. To be equivalent, all of the following conditions must be
  47. * true:
  48. * <OL TYPE=1>
  49. * <LI>
  50. * <CODE>object</CODE> is not null.
  51. * <LI>
  52. * <CODE>object</CODE> is an instance of class PrinterInfo.
  53. * <LI>
  54. * This printer info attribute's underlying string and
  55. * <CODE>object</CODE>'s underlying string are equal.
  56. * <LI>
  57. * This printer info attribute's locale and <CODE>object</CODE>'s
  58. * locale are equal.
  59. * </OL>
  60. *
  61. * @param object Object to compare to.
  62. *
  63. * @return True if <CODE>object</CODE> is equivalent to this printer
  64. * info attribute, false otherwise.
  65. */
  66. public boolean equals(Object object) {
  67. return (super.equals(object) && object instanceof PrinterInfo);
  68. }
  69. /**
  70. * Get the printing attribute class which is to be used as the "category"
  71. * for this printing attribute value.
  72. * <P>
  73. * For class PrinterInfo, the category is class PrinterInfo itself.
  74. *
  75. * @return Printing attribute class (category), an instance of class
  76. * {@link java.lang.Class java.lang.Class}.
  77. */
  78. public final Class getCategory() {
  79. return PrinterInfo.class;
  80. }
  81. /**
  82. * Get the name of the category of which this attribute value is an
  83. * instance.
  84. * <P>
  85. * For class PrinterInfo, the category name is <CODE>"printer-info"</CODE>.
  86. *
  87. * @return Attribute category name.
  88. */
  89. public final String getName() {
  90. return "printer-info";
  91. }
  92. }