1. /*
  2. * @(#)Destination.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.net.URI;
  9. import javax.print.attribute.URISyntax;
  10. import javax.print.attribute.PrintRequestAttribute;
  11. import javax.print.attribute.PrintJobAttribute;
  12. /**
  13. * Class Destination is a printing attribute class, a URI, that is used to
  14. * indicate an alternate destination for the spooled printer formatted
  15. * data. Many PrintServices will not support the notion of a destination
  16. * other than the printer device, and so will not support this attribute.
  17. * <p>
  18. * A common use for this attribute will be applications which want
  19. * to redirect output to a local disk file : eg."file:out.prn".
  20. * Note that proper construction of "file:" scheme URI instances should
  21. * be performed using the <code>toURI()</code> method of class
  22. * {@link java.io.File File}.
  23. * See the documentation on that class for more information.
  24. * <p>
  25. * If a destination URI is specified in a PrintRequest and it is not
  26. * accessible for output by the PrintService, a PrintException will be thrown.
  27. * The PrintException may implement URIException to provide a more specific
  28. * cause.
  29. * <P>
  30. * <B>IPP Compatibility:</B> Destination is not an IPP attribute.
  31. * <P>
  32. *
  33. * @author Phil Race.
  34. */
  35. public final class Destination extends URISyntax
  36. implements PrintJobAttribute, PrintRequestAttribute {
  37. /**
  38. * Constructs a new destination attribute with the specified URI.
  39. *
  40. * @param uri URI.
  41. *
  42. * @exception NullPointerException
  43. * (unchecked exception) Thrown if <CODE>uri</CODE> is null.
  44. */
  45. public Destination(URI uri) {
  46. super (uri);
  47. }
  48. /**
  49. * Returns whether this destination attribute is equivalent to the
  50. * 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 Destination.
  57. * <LI>
  58. * This destination attribute's URI and <CODE>object</CODE>'s URI
  59. * are equal.
  60. * </OL>
  61. *
  62. * @param object Object to compare to.
  63. *
  64. * @return True if <CODE>object</CODE> is equivalent to this destination
  65. * attribute, false otherwise.
  66. */
  67. public boolean equals(Object object) {
  68. return (super.equals(object) &&
  69. object instanceof Destination);
  70. }
  71. /**
  72. * Get the printing attribute class which is to be used as the "category"
  73. * for this printing attribute value.
  74. * <P>
  75. * For class Destination, the category is class Destination 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 Destination.class;
  82. }
  83. /**
  84. * Get the name of the category of which this attribute value is an
  85. * instance.
  86. * <P>
  87. * For class Destination, the category name is <CODE>"spool-data-destination"</CODE>.
  88. *
  89. * @return Attribute category name.
  90. */
  91. public final String getName() {
  92. return "spool-data-destination";
  93. }
  94. }