1 /*
   2  * Copyright (c) 2000, 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 
  29 import javax.print.attribute.Attribute;
  30 import javax.print.attribute.URISyntax;
  31 import javax.print.attribute.PrintServiceAttribute;
  32 
  33 /**
  34  * Class PrinterMoreInfo is a printing attribute class, a URI, that is used to
  35  * obtain more information about this specific printer. For example, this
  36  * could be an HTTP type URI referencing an HTML page accessible to a web
  37  * browser. The information obtained from this URI is intended for end user
  38  * consumption. Features outside the scope of the Print Service API can be
  39  * accessed from this URI.
  40  * The information is intended to be specific to this printer instance and
  41  * site specific services (e.g. job pricing, services offered, end user
  42  * assistance).
  43  * <P>
  44  * In contrast, the {@link PrinterMoreInfoManufacturer
  45  * PrinterMoreInfoManufacturer} attribute is used to find out more information
  46  * about this general kind of printer rather than this specific printer.
  47  * <P>
  48  * <B>IPP Compatibility:</B> The string form returned by
  49  * {@code toString()}  gives the IPP uri value.
  50  * The category name returned by {@code getName()}
  51  * gives the IPP attribute name.
  52  *
  53  * @author  Alan Kaminsky
  54  */
  55 public final class PrinterMoreInfo extends URISyntax
  56         implements PrintServiceAttribute {
  57 
  58     private static final long serialVersionUID = 4555850007675338574L;
  59 
  60     /**
  61      * Constructs a new printer more info attribute with the specified URI.
  62      *
  63      * @param  uri  URI.
  64      *
  65      * @exception  NullPointerException
  66      *     (unchecked exception) Thrown if {@code uri} is null.
  67      */
  68     public PrinterMoreInfo(URI uri) {
  69         super (uri);
  70     }
  71 
  72     /**
  73      * Returns whether this printer more info attribute is equivalent to the
  74      * passed in object. To be equivalent, all of the following conditions
  75      * must be true:
  76      * <OL TYPE=1>
  77      * <LI>
  78      * {@code object} is not null.
  79      * <LI>
  80      * {@code object} is an instance of class PrinterMoreInfo.
  81      * <LI>
  82      * This printer more info attribute's URI and {@code object}'s URI
  83      * are equal.
  84      * </OL>
  85      *
  86      * @param  object  Object to compare to.
  87      *
  88      * @return  True if {@code object} is equivalent to this printer
  89      *          more info attribute, false otherwise.
  90      */
  91     public boolean equals(Object object) {
  92         return (super.equals(object) &&
  93                 object instanceof PrinterMoreInfo);
  94     }
  95 
  96     /**
  97      * Get the printing attribute class which is to be used as the "category"
  98      * for this printing attribute value.
  99      * <P>
 100      * For class PrinterMoreInfo, the category is class PrinterMoreInfo itself.
 101      *
 102      * @return  Printing attribute class (category), an instance of class
 103      *          {@link java.lang.Class java.lang.Class}.
 104      */
 105     public final Class<? extends Attribute> getCategory() {
 106         return PrinterMoreInfo.class;
 107     }
 108 
 109     /**
 110      * Get the name of the category of which this attribute value is an
 111      * instance.
 112      * <P>
 113      * For class PrinterMoreInfo, the
 114      * category name is {@code "printer-more-info"}.
 115      *
 116      * @return  Attribute category name.
 117      */
 118     public final String getName() {
 119         return "printer-more-info";
 120     }
 121 
 122 }