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