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