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.net.URI;
   28   
   29   import javax.print.attribute.Attribute;
   30   import javax.print.attribute.URISyntax;
   31   import javax.print.attribute.PrintRequestAttribute;
   32   import javax.print.attribute.PrintJobAttribute;
   33   
   34   /**
   35    * Class Destination is a printing attribute class, a URI, that is used to
   36    * indicate an alternate destination for the spooled printer formatted
   37    * data. Many PrintServices will not support the notion of a destination
   38    * other than the printer device, and so will not support this attribute.
   39    * <p>
   40    * A common use for this attribute will be applications which want
   41    * to redirect output to a local disk file : eg."file:out.prn".
   42    * Note that proper construction of "file:" scheme URI instances should
   43    * be performed using the <code>toURI()</code> method of class
   44    * {@link java.io.File File}.
   45    * See the documentation on that class for more information.
   46    * <p>
   47    * If a destination URI is specified in a PrintRequest and it is not
   48    * accessible for output by the PrintService, a PrintException will be thrown.
   49    * The PrintException may implement URIException to provide a more specific
   50    * cause.
   51    * <P>
   52    * <B>IPP Compatibility:</B> Destination is not an IPP attribute.
   53    * <P>
   54    *
   55    * @author  Phil Race.
   56    */
   57   public final class Destination extends URISyntax
   58           implements PrintJobAttribute, PrintRequestAttribute {
   59   
   60       private static final long serialVersionUID = 6776739171700415321L;
   61   
   62       /**
   63        * Constructs a new destination attribute with the specified URI.
   64        *
   65        * @param  uri  URI.
   66        *
   67        * @exception  NullPointerException
   68        *     (unchecked exception) Thrown if <CODE>uri</CODE> is null.
   69        */
   70       public Destination(URI uri) {
   71           super (uri);
   72       }
   73   
   74       /**
   75        * Returns whether this destination attribute is equivalent to the
   76        * passed in object. To be equivalent, all of the following conditions
   77        * must be true:
   78        * <OL TYPE=1>
   79        * <LI>
   80        * <CODE>object</CODE> is not null.
   81        * <LI>
   82        * <CODE>object</CODE> is an instance of class Destination.
   83        * <LI>
   84        * This destination attribute's URI and <CODE>object</CODE>'s URI
   85        * are equal.
   86        * </OL>
   87        *
   88        * @param  object  Object to compare to.
   89        *
   90        * @return  True if <CODE>object</CODE> is equivalent to this destination
   91        *         attribute, false otherwise.
   92        */
   93       public boolean equals(Object object) {
   94           return (super.equals(object) &&
   95                   object instanceof Destination);
   96       }
   97   
   98       /**
   99        * Get the printing attribute class which is to be used as the "category"
  100        * for this printing attribute value.
  101        * <P>
  102        * For class Destination, the category is class Destination itself.
  103        *
  104        * @return  Printing attribute class (category), an instance of class
  105        *          {@link java.lang.Class java.lang.Class}.
  106        */
  107       public final Class<? extends Attribute> getCategory() {
  108           return Destination.class;
  109       }
  110   
  111       /**
  112        * Get the name of the category of which this attribute value is an
  113        * instance.
  114        * <P>
  115        * For class Destination, the category name is <CODE>"spool-data-destination"</CODE>.
  116        *
  117        * @return  Attribute category name.
  118        */
  119       public final String getName() {
  120           return "spool-data-destination";
  121       }
  122   
  123   }

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