Home » openjdk-7 » javax » print » attribute » standard » [javadoc | source]

    1   /*
    2    * Copyright (c) 2000, 2004, 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 PrinterName is a printing attribute class, a text attribute, that
   35    * specifies the name of a printer. It is a name that is more end-user friendly
   36    * than a URI. An administrator determines a printer's name and sets this
   37    * attribute to that name. This name may be the last part of the printer's URI
   38    * or it may be unrelated. In non-US-English locales, a name may contain
   39    * characters that are not allowed in a URI.
   40    * <P>
   41    * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
   42    * locale gives the IPP natural language. The category name returned by
   43    * <CODE>getName()</CODE> gives the IPP attribute name.
   44    * <P>
   45    *
   46    * @author  Alan Kaminsky
   47    */
   48   public final class PrinterName extends TextSyntax
   49           implements PrintServiceAttribute {
   50   
   51       private static final long serialVersionUID = 299740639137803127L;
   52   
   53       /**
   54        * Constructs a new printer name attribute with the given name and locale.
   55        *
   56        * @param  printerName  Printer name.
   57        * @param  locale       Natural language of the text string. null
   58        * is interpreted to mean the default locale as returned
   59        * by <code>Locale.getDefault()</code>
   60        *
   61        * @exception  NullPointerException
   62        *     (unchecked exception) Thrown if <CODE>printerName</CODE> is null.
   63        */
   64       public PrinterName(String printerName, Locale locale) {
   65           super (printerName, locale);
   66       }
   67   
   68       /**
   69        * Returns whether this printer name attribute is equivalent to the passed
   70        * in object. To be equivalent, all of the following conditions must be
   71        * true:
   72        * <OL TYPE=1>
   73        * <LI>
   74        * <CODE>object</CODE> is not null.
   75        * <LI>
   76        * <CODE>object</CODE> is an instance of class PrinterName.
   77        * <LI>
   78        * This printer name attribute's underlying string and
   79        * <CODE>object</CODE>'s underlying string are equal.
   80        * <LI>
   81        * This printer name attribute's locale and <CODE>object</CODE>'s locale
   82        * are equal.
   83        * </OL>
   84        *
   85        * @param  object  Object to compare to.
   86        *
   87        * @return  True if <CODE>object</CODE> is equivalent to this printer
   88        *          name attribute, false otherwise.
   89        */
   90       public boolean equals(Object object) {
   91           return (super.equals(object) && object instanceof PrinterName);
   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 PrinterName, the category is
   99        * class PrinterName 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 PrinterName.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 PrinterName, the category
  113        * name is <CODE>"printer-name"</CODE>.
  114        *
  115        * @return  Attribute category name.
  116        */
  117       public final String getName() {
  118           return "printer-name";
  119       }
  120   
  121   }

Home » openjdk-7 » javax » print » attribute » standard » [javadoc | source]