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