1. /*
  2. * @(#)DateTimeAtProcessing.java 1.7 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.Date;
  9. import javax.print.attribute.Attribute;
  10. import javax.print.attribute.DateTimeSyntax;
  11. import javax.print.attribute.PrintJobAttribute;
  12. /**
  13. * Class DateTimeAtProcessing is a printing attribute class, a date-time
  14. * attribute, that indicates the date and time at which the Print Job first
  15. * began processing.
  16. * <P>
  17. * To construct a DateTimeAtProcessing attribute from separate values of the
  18. * year, month, day, hour, minute, and so on, use a {@link java.util.Calendar
  19. * Calendar} object to construct a {@link java.util.Date Date} object, then use
  20. * the {@link java.util.Date Date} object to construct the DateTimeAtProcessing
  21. * attribute. To convert a DateTimeAtProcessing attribute to separate values of
  22. * the year, month, day, hour, minute, and so on, create a {@link
  23. * java.util.Calendar Calendar} object and set it to the {@link java.util.Date
  24. * Date} from the DateTimeAtProcessing attribute.
  25. * <P>
  26. * <B>IPP Compatibility:</B> The information needed to construct an IPP
  27. * "date-time-at-processing" attribute can be obtained as described above. The
  28. * category name returned by <CODE>getName()</CODE> gives the IPP attribute
  29. * name.
  30. * <P>
  31. *
  32. * @author Alan Kaminsky
  33. */
  34. public final class DateTimeAtProcessing extends DateTimeSyntax
  35. implements PrintJobAttribute {
  36. private static final long serialVersionUID = -3710068197278263244L;
  37. /**
  38. * Construct a new date-time at processing attribute with the given {@link
  39. * java.util.Date Date} value.
  40. *
  41. * @param dateTime {@link java.util.Date Date} value.
  42. *
  43. * @exception NullPointerException
  44. * (unchecked exception) Thrown if <CODE>dateTime</CODE> is null.
  45. */
  46. public DateTimeAtProcessing(Date dateTime) {
  47. super (dateTime);
  48. }
  49. /**
  50. * Returns whether this date-time at processing attribute is equivalent to
  51. * the passed in object. To be equivalent, all of the following conditions
  52. * must be true:
  53. * <OL TYPE=1>
  54. * <LI>
  55. * <CODE>object</CODE> is not null.
  56. * <LI>
  57. * <CODE>object</CODE> is an instance of class DateTimeAtProcessing.
  58. * <LI>
  59. * This date-time at processing attribute's {@link java.util.Date Date}
  60. * value and <CODE>object</CODE>'s {@link java.util.Date Date} value
  61. * are equal.
  62. * </OL>
  63. *
  64. * @param object Object to compare to.
  65. *
  66. * @return True if <CODE>object</CODE> is equivalent to this date-time
  67. * at processing attribute, false otherwise.
  68. */
  69. public boolean equals(Object object) {
  70. return(super.equals (object) &&
  71. object instanceof DateTimeAtProcessing);
  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 DateTimeAtProcessing, the category is class
  78. * DateTimeAtProcessing itself.
  79. *
  80. * @return Printing attribute class (category), an instance of class
  81. * {@link java.lang.Class java.lang.Class}.
  82. */
  83. public final Class<? extends Attribute> getCategory() {
  84. return DateTimeAtProcessing.class;
  85. }
  86. /**
  87. * Get the name of the category of which this attribute value is an
  88. * instance.
  89. * <P>
  90. * For class DateTimeAtProcessing, the category name is
  91. * <CODE>"date-time-at-processing"</CODE>.
  92. *
  93. * @return Attribute category name.
  94. */
  95. public final String getName() {
  96. return "date-time-at-processing";
  97. }
  98. }