1. /*
  2. * @(#)OutputDeviceAssigned.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.PrintJobAttribute;
  11. /**
  12. * Class OutputDeviceAssigned is a printing attribute class, a text attribute,
  13. * that identifies the output device to which the service has assigned this
  14. * job. If an output device implements an embedded Print Service instance, the
  15. * printer need not set this attribute. If a print server implements a
  16. * Print Service instance, the value may be empty (zero- length string) or not
  17. * returned until the service assigns an output device to the job. This
  18. * attribute is particularly useful when a single service supports multiple
  19. * devices (so called "fan-out").
  20. * <P>
  21. * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
  22. * locale gives the IPP natural language. The category name returned by
  23. * <CODE>getName()</CODE> gives the IPP attribute name.
  24. * <P>
  25. *
  26. * @author Alan Kaminsky
  27. */
  28. public final class OutputDeviceAssigned extends TextSyntax
  29. implements PrintJobAttribute {
  30. /**
  31. * Constructs a new output device assigned attribute with the given device
  32. * name and locale.
  33. *
  34. * @param deviceName Device name.
  35. * @param locale Natural language of the text string. null
  36. * is interpreted to mean the default locale as returned
  37. * by <code>Locale.getDefault()</code>
  38. *
  39. * @exception NullPointerException
  40. * (unchecked exception) Thrown if <CODE>deviceName</CODE> is null.
  41. */
  42. public OutputDeviceAssigned(String deviceName, Locale locale) {
  43. super (deviceName, locale);
  44. }
  45. // Exported operations inherited and overridden from class Object.
  46. /**
  47. * Returns whether this output device assigned attribute is equivalent to
  48. * the passed in object. To be equivalent, all of the following conditions
  49. * must be true:
  50. * <OL TYPE=1>
  51. * <LI>
  52. * <CODE>object</CODE> is not null.
  53. * <LI>
  54. * <CODE>object</CODE> is an instance of class OutputDeviceAssigned.
  55. * <LI>
  56. * This output device assigned attribute's underlying string and
  57. * <CODE>object</CODE>'s underlying string are equal.
  58. * <LI>
  59. * This output device assigned attribute's locale and
  60. * <CODE>object</CODE>'s locale are equal.
  61. * </OL>
  62. *
  63. * @param object Object to compare to.
  64. *
  65. * @return True if <CODE>object</CODE> is equivalent to this output
  66. * device assigned attribute, false otherwise.
  67. */
  68. public boolean equals(Object object) {
  69. return (super.equals (object) &&
  70. object instanceof OutputDeviceAssigned);
  71. }
  72. /**
  73. * Get the printing attribute class which is to be used as the "category"
  74. * for this printing attribute value.
  75. * <P>
  76. * For class OutputDeviceAssigned, the
  77. * category is class OutputDeviceAssigned itself.
  78. *
  79. * @return Printing attribute class (category), an instance of class
  80. * {@link java.lang.Class java.lang.Class}.
  81. */
  82. public final Class getCategory() {
  83. return OutputDeviceAssigned.class;
  84. }
  85. /**
  86. * Get the name of the category of which this attribute value is an
  87. * instance.
  88. * <P>
  89. * For class OutputDeviceAssigned, the
  90. * category name is <CODE>"output-device-assigned"</CODE>.
  91. *
  92. * @return Attribute category name.
  93. */
  94. public final String getName() {
  95. return "output-device-assigned";
  96. }
  97. }