1. /*
  2. * @(#)PrinterURI.java 1.6 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.net.URI;
  9. import java.util.Locale;
  10. import javax.print.attribute.Attribute;
  11. import javax.print.attribute.URISyntax;
  12. import javax.print.attribute.PrintServiceAttribute;
  13. /**
  14. * Class PrinterURI is a printing attribute class, a URI, that specifies the
  15. * globally unique name of a printer. If it has such a name, an administrator
  16. * determines a printer's URI and sets this attribute to that name.
  17. * <P>
  18. * <B>IPP Compatibility:</B> This implements the
  19. * IPP printer-uri attribute. The string form returned by
  20. * <CODE>toString()</CODE> gives the IPP printer-uri value.
  21. * The category name returned by <CODE>getName()</CODE>
  22. * gives the IPP attribute name.
  23. * <P>
  24. *
  25. * @author Robert Herriot
  26. */
  27. public final class PrinterURI extends URISyntax
  28. implements PrintServiceAttribute {
  29. private static final long serialVersionUID = 7923912792485606497L;
  30. /**
  31. * Constructs a new PrinterURI attribute with the specified URI.
  32. *
  33. * @param uri URI of the printer
  34. *
  35. * @exception NullPointerException
  36. * (unchecked exception) Thrown if <CODE>uri</CODE> is null.
  37. */
  38. public PrinterURI(URI uri) {
  39. super (uri);
  40. }
  41. /**
  42. * Returns whether this printer name attribute is equivalent to the passed
  43. * in object. To be equivalent, all of the following conditions must be
  44. * true:
  45. * <OL TYPE=1>
  46. * <LI>
  47. * <CODE>object</CODE> is not null.
  48. * <LI>
  49. * <CODE>object</CODE> is an instance of class PrinterURI.
  50. * <LI>
  51. * This PrinterURI attribute's underlying URI and
  52. * <CODE>object</CODE>'s underlying URI are equal.
  53. * </OL>
  54. *
  55. * @param object Object to compare to.
  56. *
  57. * @return True if <CODE>object</CODE> is equivalent to this PrinterURI
  58. * attribute, false otherwise.
  59. */
  60. public boolean equals(Object object) {
  61. return (super.equals(object) && object instanceof PrinterURI);
  62. }
  63. /**
  64. * Get the printing attribute class which is to be used as the "category"
  65. * for this printing attribute value.
  66. * <P>
  67. * For class PrinterURI and any vendor-defined subclasses, the category is
  68. * class PrinterURI itself.
  69. *
  70. * @return Printing attribute class (category), an instance of class
  71. * {@link java.lang.Class java.lang.Class}.
  72. */
  73. public final Class<? extends Attribute> getCategory() {
  74. return PrinterURI.class;
  75. }
  76. /**
  77. * Get the name of the category of which this attribute value is an
  78. * instance.
  79. * <P>
  80. * For class PrinterURI and any vendor-defined subclasses, the category
  81. * name is <CODE>"printer-uri"</CODE>.
  82. *
  83. * @return Attribute category name.
  84. */
  85. public final String getName() {
  86. return "printer-uri";
  87. }
  88. }