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