< prev index next >

src/java.desktop/share/classes/javax/print/attribute/standard/PrinterInfo.java

Print this page


   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.util.Locale;
  28 
  29 import javax.print.attribute.Attribute;
  30 import javax.print.attribute.TextSyntax;
  31 import javax.print.attribute.PrintServiceAttribute;

  32 
  33 /**
  34  * Class PrinterInfo is a printing attribute class, a text attribute, that
  35  * provides descriptive information about a printer. This could include things
  36  * like: {@code "This printer can be used for printing color transparencies for
  37  * HR presentations"}, or {@code "Out of courtesy for others, please
  38  * print only small (1-5 page) jobs at this printer"}, or even
  39  * {@code "This printer is going away on July 1, 1997, please find a new
  40  * printer"}.
  41  * <P>
  42  * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
  43  * locale gives the IPP natural language. The category name returned by
  44  * {@code getName()} gives the IPP attribute name.
  45  *
  46  * @author  Alan Kaminsky
  47  */
  48 public final class PrinterInfo extends TextSyntax
  49         implements PrintServiceAttribute {
  50 



  51     private static final long serialVersionUID = 7765280618777599727L;
  52 
  53     /**
  54      * Constructs a new printer info attribute with the given information
  55      * string and locale.
  56      *
  57      * @param  info    Printer information string.
  58      * @param  locale  Natural language of the text string. null
  59      * is interpreted to mean the default locale as returned
  60      * by {@code Locale.getDefault()}
  61      *
  62      * @exception  NullPointerException
  63      *     (unchecked exception) Thrown if {@code info} is null.
  64      */
  65     public PrinterInfo(String info, Locale locale) {
  66         super (info, locale);
  67     }
  68 
  69     /**
  70      * Returns whether this printer info attribute is equivalent to the passed
  71      * in object. To be equivalent, all of the following conditions must be
  72      * true:
  73      * <OL TYPE=1>
  74      * <LI>
  75      * {@code object} is not null.
  76      * <LI>
  77      * {@code object} is an instance of class PrinterInfo.
  78      * <LI>
  79      * This printer info attribute's underlying string and
  80      * {@code object}'s underlying string are equal.
  81      * <LI>
  82      * This printer info attribute's locale and {@code object}'s
  83      * locale 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      *          info attribute, false otherwise.
  90      */
  91     public boolean equals(Object object) {
  92         return (super.equals(object) && object instanceof PrinterInfo);
  93     }
  94 
  95     /**
  96      * Get the printing attribute class which is to be used as the "category"
  97      * for this printing attribute value.
  98      * <P>
  99      * For class PrinterInfo, the category is class PrinterInfo itself.

 100      *
 101      * @return  Printing attribute class (category), an instance of class
 102      *          {@link java.lang.Class java.lang.Class}.
 103      */
 104     public final Class<? extends Attribute> getCategory() {
 105         return PrinterInfo.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 PrinterInfo, the category name is {@code "printer-info"}.

 113      *
 114      * @return  Attribute category name.
 115      */
 116     public final String getName() {
 117         return "printer-info";
 118     }
 119 
 120 }
   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 
  26 package javax.print.attribute.standard;
  27 
  28 import java.util.Locale;
  29 
  30 import javax.print.attribute.Attribute;

  31 import javax.print.attribute.PrintServiceAttribute;
  32 import javax.print.attribute.TextSyntax;
  33 
  34 /**
  35  * Class {@code PrinterInfo} is a printing attribute class, a text attribute,
  36  * that provides descriptive information about a printer. This could include
  37  * things like: {@code "This printer can be used for printing color
  38  * transparencies for HR presentations"}, or {@code "Out of courtesy for others,
  39  * please print only small (1-5 page) jobs at this printer"}, or even
  40  * {@code "This printer is going away on July 1, 1997, please find a new
  41  * printer"}.
  42  * <p>
  43  * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
  44  * locale gives the IPP natural language. The category name returned by {@code
  45  * getName()} gives the IPP attribute name.
  46  *
  47  * @author Alan Kaminsky
  48  */
  49 public final class PrinterInfo extends TextSyntax
  50         implements PrintServiceAttribute {
  51 
  52     /**
  53      * Use serialVersionUID from JDK 1.4 for interoperability.
  54      */
  55     private static final long serialVersionUID = 7765280618777599727L;
  56 
  57     /**
  58      * Constructs a new printer info attribute with the given information string
  59      * and locale.
  60      *
  61      * @param  info printer information string
  62      * @param  locale natural language of the text string. {@code null} is
  63      *         interpreted to mean the default locale as returned by
  64      *         {@code Locale.getDefault()}
  65      * @throws NullPointerException if {@code info} is {@code null}


  66      */
  67     public PrinterInfo(String info, Locale locale) {
  68         super (info, locale);
  69     }
  70 
  71     /**
  72      * Returns whether this printer info attribute is equivalent to the passed
  73      * in object. To be equivalent, all of the following conditions must be
  74      * true:
  75      * <ol type=1>
  76      *   <li>{@code object} is not {@code null}.
  77      *   <li>{@code object} is an instance of class {@code PrinterInfo}.
  78      *   <li>This printer info attribute's underlying string and



  79      *   {@code object}'s underlying string are equal.
  80      *   <li>This printer info attribute's locale and {@code object}'s locale
  81      *   are equal.
  82      * </ol>
  83      *
  84      * @param  object {@code Object} to compare to
  85      * @return {@code true} if {@code object} is equivalent to this printer info
  86      *         attribute, {@code false} otherwise


  87      */
  88     public boolean equals(Object object) {
  89         return (super.equals(object) && object instanceof PrinterInfo);
  90     }
  91 
  92     /**
  93      * Get the printing attribute class which is to be used as the "category"
  94      * for this printing attribute value.
  95      * <p>
  96      * For class {@code PrinterInfo}, the category is class
  97      * {@code PrinterInfo} itself.
  98      *
  99      * @return printing attribute class (category), an instance of class
 100      *         {@link Class java.lang.Class}
 101      */
 102     public final Class<? extends Attribute> getCategory() {
 103         return PrinterInfo.class;
 104     }
 105 
 106     /**
 107      * Get the name of the category of which this attribute value is an
 108      * instance.
 109      * <p>
 110      * For class {@code PrinterInfo}, the category name is
 111      * {@code "printer-info"}.
 112      *
 113      * @return attribute category name
 114      */
 115     public final String getName() {
 116         return "printer-info";
 117     }

 118 }
< prev index next >