PrinterURI.java revision 13629:5bb70b2df494
185815Sobrien/* 285815Sobrien * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 385815Sobrien * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4218822Sdim * 5218822Sdim * This code is free software; you can redistribute it and/or modify it 685815Sobrien * under the terms of the GNU General Public License version 2 only, as 7218822Sdim * published by the Free Software Foundation. Oracle designates this 8218822Sdim * particular file as subject to the "Classpath" exception as provided 985815Sobrien * by Oracle in the LICENSE file that accompanied this code. 10218822Sdim * 1185815Sobrien * This code is distributed in the hope that it will be useful, but WITHOUT 12218822Sdim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13218822Sdim * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14218822Sdim * version 2 for more details (a copy is included in the LICENSE file that 15218822Sdim * accompanied this code). 1685815Sobrien * 17218822Sdim * You should have received a copy of the GNU General Public License version 18218822Sdim * 2 along with this work; if not, write to the Free Software Foundation, 19218822Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20218822Sdim * 2185815Sobrien * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22218822Sdim * or visit www.oracle.com if you need additional information or have any 23218822Sdim * questions. 24218822Sdim */ 2585815Sobrienpackage javax.print.attribute.standard; 2685815Sobrien 2785815Sobrienimport java.net.URI; 2885815Sobrienimport java.util.Locale; 2985815Sobrien 3085815Sobrienimport javax.print.attribute.Attribute; 3185815Sobrienimport javax.print.attribute.URISyntax; 3285815Sobrienimport javax.print.attribute.PrintServiceAttribute; 3385815Sobrien 3485815Sobrien/** 3585815Sobrien * Class PrinterURI is a printing attribute class, a URI, that specifies the 3685815Sobrien * globally unique name of a printer. If it has such a name, an administrator 3789857Sobrien * determines a printer's URI and sets this attribute to that name. 3889857Sobrien * <P> 3989857Sobrien * <B>IPP Compatibility:</B> This implements the 4085815Sobrien * IPP printer-uri attribute. The string form returned by 4189857Sobrien * {@code toString()} gives the IPP printer-uri value. 4285815Sobrien * The category name returned by {@code getName()} 4389857Sobrien * gives the IPP attribute name. 4485815Sobrien * 4585815Sobrien * @author Robert Herriot 4685815Sobrien */ 47130561Sobrien 4885815Sobrienpublic final class PrinterURI extends URISyntax 4989857Sobrien implements PrintServiceAttribute { 5085815Sobrien 5189857Sobrien private static final long serialVersionUID = 7923912792485606497L; 5289857Sobrien 5389857Sobrien /** 5489857Sobrien * Constructs a new PrinterURI attribute with the specified URI. 5589857Sobrien * 5689857Sobrien * @param uri URI of the printer 5789857Sobrien * 5889857Sobrien * @exception NullPointerException 5989857Sobrien * (unchecked exception) Thrown if {@code uri} is null. 6089857Sobrien */ 6189857Sobrien public PrinterURI(URI uri) { 6289857Sobrien super (uri); 6389857Sobrien } 64130561Sobrien 6589857Sobrien /** 6689857Sobrien * Returns whether this printer name attribute is equivalent to the passed 6789857Sobrien * in object. To be equivalent, all of the following conditions must be 6889857Sobrien * true: 6989857Sobrien * <OL TYPE=1> 7089857Sobrien * <LI> 7189857Sobrien * {@code object} is not null. 7289857Sobrien * <LI> 7389857Sobrien * {@code object} is an instance of class PrinterURI. 7489857Sobrien * <LI> 7589857Sobrien * This PrinterURI attribute's underlying URI and 7689857Sobrien * {@code object}'s underlying URI are equal. 7789857Sobrien * </OL> 7889857Sobrien * 7989857Sobrien * @param object Object to compare to. 8089857Sobrien * 8189857Sobrien * @return True if {@code object} is equivalent to this PrinterURI 8289857Sobrien * attribute, false otherwise. 8389857Sobrien */ 8489857Sobrien public boolean equals(Object object) { 8589857Sobrien return (super.equals(object) && object instanceof PrinterURI); 8689857Sobrien } 8789857Sobrien 8889857Sobrien /** 8989857Sobrien * Get the printing attribute class which is to be used as the "category" 9089857Sobrien * for this printing attribute value. 9189857Sobrien * <P> 9289857Sobrien * For class PrinterURI and any vendor-defined subclasses, the category is 9389857Sobrien * class PrinterURI itself. 9489857Sobrien * 9589857Sobrien * @return Printing attribute class (category), an instance of class 9689857Sobrien * {@link java.lang.Class java.lang.Class}. 9789857Sobrien */ 9889857Sobrien public final Class<? extends Attribute> getCategory() { 9989857Sobrien return PrinterURI.class; 10089857Sobrien } 10189857Sobrien 10289857Sobrien /** 10389857Sobrien * Get the name of the category of which this attribute value is an 10489857Sobrien * instance. 10589857Sobrien * <P> 10689857Sobrien * For class PrinterURI and any vendor-defined subclasses, the category 10789857Sobrien * name is {@code "printer-uri"}. 10889857Sobrien * 10989857Sobrien * @return Attribute category name. 11089857Sobrien */ 11189857Sobrien public final String getName() { 11289857Sobrien return "printer-uri"; 11389857Sobrien } 11489857Sobrien 11589857Sobrien} 11689857Sobrien