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