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