1. /*
  2. * @(#)JobName.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.PrintRequestAttribute;
  11. import javax.print.attribute.PrintJobAttribute;
  12. /**
  13. * Class JobName is a printing attribute class, a text attribute, that specifies
  14. * the name of a print job. A job's name is an arbitrary string defined by the
  15. * client. It does not need to be unique between different jobs. A Print Job's
  16. * JobName attribute is set to the value supplied by the client in the Print
  17. * Request's attribute set. If, however, the client does not supply a JobName
  18. * attribute in the Print Request, the printer, when it creates the Print Job,
  19. * must generate a JobName. The printer should generate the value of the Print
  20. * Job's JobName attribute from the first of the following sources that produces
  21. * a value: (1) the {@link DocumentName DocumentName} attribute of the first (or
  22. * only) doc in the job, (2) the URL of the first (or only) doc in the job, if
  23. * the doc's print data representation object is a URL, or (3) any other piece
  24. * of Print Job specific and/or document content information.
  25. * <P>
  26. * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
  27. * locale gives the IPP natural language. The category name returned by
  28. * <CODE>getName()</CODE> gives the IPP attribute name.
  29. * <P>
  30. *
  31. * @author Alan Kaminsky
  32. */
  33. public final class JobName extends TextSyntax
  34. implements PrintRequestAttribute, PrintJobAttribute {
  35. /**
  36. * Constructs a new job name attribute with the given job name and locale.
  37. *
  38. * @param jobName Job name.
  39. * @param locale Natural language of the text string. null
  40. * is interpreted to mean the default locale as returned
  41. * by <code>Locale.getDefault()</code>
  42. *
  43. * @exception NullPointerException
  44. * (unchecked exception) Thrown if <CODE>jobName</CODE> is null.
  45. */
  46. public JobName(String jobName, Locale locale) {
  47. super (jobName, locale);
  48. }
  49. /**
  50. * Returns whether this job name attribute is equivalent to the passed in
  51. * object. To be equivalent, all of the following conditions 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 JobName.
  57. * <LI>
  58. * This job name attribute's underlying string and <CODE>object</CODE>'s
  59. * underlying string are equal.
  60. * <LI>
  61. * This job name attribute's locale and <CODE>object</CODE>'s locale are
  62. * equal.
  63. * </OL>
  64. *
  65. * @param object Object to compare to.
  66. *
  67. * @return True if <CODE>object</CODE> is equivalent to this job name
  68. * attribute, false otherwise.
  69. */
  70. public boolean equals(Object object) {
  71. return (super.equals(object) && object instanceof JobName);
  72. }
  73. /**
  74. * Get the printing attribute class which is to be used as the "category"
  75. * for this printing attribute value.
  76. * <P>
  77. * For class JobName, the category is class JobName 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 JobName.class;
  84. }
  85. /**
  86. * Get the name of the category of which this attribute value is an
  87. * instance.
  88. * <P>
  89. * For class JobName, the category name is <CODE>"job-name"</CODE>.
  90. *
  91. * @return Attribute category name.
  92. */
  93. public final String getName() {
  94. return "job-name";
  95. }
  96. }