1. /*
  2. * @(#)DateTimeAtCompleted.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 DateTimeAtCompleted is a printing attribute class, a date-time
  14. * attribute, that indicates the date and time at which the Print Job completed
  15. * (or was canceled or aborted).
  16. * <P>
  17. * To construct a DateTimeAtCompleted 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 DateTimeAtCompleted
  21. * attribute. To convert a DateTimeAtCompleted 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 DateTimeAtCompleted attribute.
  25. * <P>
  26. * <B>IPP Compatibility:</B> The information needed to construct an IPP
  27. * "date-time-at-completed" 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 DateTimeAtCompleted extends DateTimeSyntax
  35. implements PrintJobAttribute {
  36. private static final long serialVersionUID = 6497399708058490000L;
  37. /**
  38. * Construct a new date-time at completed 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 DateTimeAtCompleted(Date dateTime) {
  47. super (dateTime);
  48. }
  49. /**
  50. * Returns whether this date-time at completed 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 DateTimeAtCompleted.
  58. * <LI>
  59. * This date-time at completed attribute's {@link java.util.Date Date} value
  60. * and <CODE>object</CODE>'s {@link java.util.Date Date} value are equal.
  61. * </OL>
  62. *
  63. * @param object Object to compare to.
  64. *
  65. * @return True if <CODE>object</CODE> is equivalent to this date-time
  66. * at completed attribute, false otherwise.
  67. */
  68. public boolean equals(Object object) {
  69. return(super.equals (object) &&
  70. object instanceof DateTimeAtCompleted);
  71. }
  72. // Exported operations inherited and implemented from interface Attribute.
  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 DateTimeAtCompleted, the category is class
  78. * DateTimeAtCompleted 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 DateTimeAtCompleted.class;
  85. }
  86. /**
  87. * Get the name of the category of which this attribute value is an
  88. * instance.
  89. * <P>
  90. * For class DateTimeAtCompleted, the category name is
  91. * <CODE>"date-time-at-completed"</CODE>.
  92. *
  93. * @return Attribute category name.
  94. */
  95. public final String getName() {
  96. return "date-time-at-completed";
  97. }
  98. }