1 /* 2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package javax.print.attribute.standard; 26 27 import java.net.URI; 28 import java.util.Locale; 29 30 import javax.print.attribute.Attribute; 31 import javax.print.attribute.URISyntax; 32 import javax.print.attribute.PrintServiceAttribute; 33 34 /** 35 * Class PrinterURI is a printing attribute class, a URI, that specifies the 36 * globally unique name of a printer. If it has such a name, an administrator 37 * determines a printer's URI and sets this attribute to that name. 38 * <P> 39 * <B>IPP Compatibility:</B> This implements the 40 * IPP printer-uri attribute. The string form returned by 41 * {@code toString()} gives the IPP printer-uri value. 42 * The category name returned by {@code getName()} 43 * gives the IPP attribute name. 44 * 45 * @author Robert Herriot 46 */ 47 48 public final class PrinterURI extends URISyntax 49 implements PrintServiceAttribute { 50 51 private static final long serialVersionUID = 7923912792485606497L; 52 53 /** 54 * Constructs a new PrinterURI attribute with the specified URI. 55 * 56 * @param uri URI of the printer 57 * 58 * @exception NullPointerException 59 * (unchecked exception) Thrown if {@code uri} is null. 60 */ 61 public PrinterURI(URI uri) { 62 super (uri); 63 } 64 65 /** 66 * Returns whether this printer name attribute is equivalent to the passed 67 * in object. To be equivalent, all of the following conditions must be 68 * true: 69 * <OL TYPE=1> 70 * <LI> 71 * {@code object} is not null. 72 * <LI> 73 * {@code object} is an instance of class PrinterURI. 74 * <LI> 75 * This PrinterURI attribute's underlying URI and 76 * {@code object}'s underlying URI are equal. 77 * </OL> 78 * 79 * @param object Object to compare to. 80 * 81 * @return True if {@code object} is equivalent to this PrinterURI 82 * attribute, false otherwise. 83 */ 84 public boolean equals(Object object) { 85 return (super.equals(object) && object instanceof PrinterURI); 86 } 87 88 /** 89 * Get the printing attribute class which is to be used as the "category" 90 * for this printing attribute value. 91 * <P> 92 * For class PrinterURI and any vendor-defined subclasses, the category is 93 * class PrinterURI itself. 94 * 95 * @return Printing attribute class (category), an instance of class 96 * {@link java.lang.Class java.lang.Class}. 97 */ 98 public final Class<? extends Attribute> getCategory() { 99 return PrinterURI.class; 100 } 101 102 /** 103 * Get the name of the category of which this attribute value is an 104 * instance. 105 * <P> 106 * For class PrinterURI and any vendor-defined subclasses, the category 107 * name is {@code "printer-uri"}. 108 * 109 * @return Attribute category name. 110 */ 111 public final String getName() { 112 return "printer-uri"; 113 } 114 115 }