jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobName.java
changeset 47196 a3211bb4daff
parent 35667 ed476aba94de
equal deleted inserted replaced
47195:b309b58eb190 47196:a3211bb4daff
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
     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.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    20  *
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    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
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    23  * questions.
    24  */
    24  */
       
    25 
    25 package javax.print.attribute.standard;
    26 package javax.print.attribute.standard;
    26 
    27 
    27 import java.util.Locale;
    28 import java.util.Locale;
    28 
    29 
    29 import javax.print.attribute.Attribute;
    30 import javax.print.attribute.Attribute;
       
    31 import javax.print.attribute.PrintJobAttribute;
       
    32 import javax.print.attribute.PrintRequestAttribute;
    30 import javax.print.attribute.TextSyntax;
    33 import javax.print.attribute.TextSyntax;
    31 import javax.print.attribute.PrintRequestAttribute;
       
    32 import javax.print.attribute.PrintJobAttribute;
       
    33 
    34 
    34 /**
    35 /**
    35  * Class JobName is a printing attribute class, a text attribute, that specifies
    36  * Class {@code JobName} is a printing attribute class, a text attribute, that
    36  * the name of a print job. A job's name is an arbitrary string defined by the
    37  * specifies the name of a print job. A job's name is an arbitrary string
    37  * client. It does not need to be unique between different jobs. A Print Job's
    38  * defined by the client. It does not need to be unique between different jobs.
    38  * JobName attribute is set to the value supplied by the client in the Print
    39  * A Print Job's {@code JobName} attribute is set to the value supplied by the
    39  * Request's attribute set. If, however, the client does not supply a JobName
    40  * client in the Print Request's attribute set. If, however, the client does not
    40  * attribute in the Print Request, the printer, when it creates the Print Job,
    41  * supply a {@code JobName} attribute in the Print Request, the printer, when it
    41  * must generate a JobName. The printer should generate the value of the Print
    42  * creates the Print Job, must generate a {@code JobName}. The printer should
    42  * Job's JobName attribute from the first of the following sources that produces
    43  * generate the value of the Print Job's {@code JobName} attribute from the
    43  * a value: (1) the {@link DocumentName DocumentName} attribute of the first (or
    44  * first of the following sources that produces a value: (1) the
    44  * only) doc in the job, (2) the URL of the first (or only) doc in the job, if
    45  * {@link DocumentName DocumentName} attribute of the first (or only) doc in the
    45  * the doc's print data representation object is a URL, or (3) any other piece
    46  * job, (2) the {@code URL} of the first (or only) doc in the job, if the doc's
    46  * of Print Job specific and/or document content information.
    47  * print data representation object is a {@code URL}, or (3) any other piece of
    47  * <P>
    48  * Print Job specific and/or document content information.
    48  * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
    49  * <p>
       
    50  * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
    49  * locale gives the IPP natural language. The category name returned by
    51  * locale gives the IPP natural language. The category name returned by
    50  * {@code getName()} gives the IPP attribute name.
    52  * {@code getName()} gives the IPP attribute name.
    51  *
    53  *
    52  * @author  Alan Kaminsky
    54  * @author Alan Kaminsky
    53  */
    55  */
    54 public final class JobName extends TextSyntax
    56 public final class JobName extends TextSyntax
    55         implements PrintRequestAttribute, PrintJobAttribute {
    57         implements PrintRequestAttribute, PrintJobAttribute {
    56 
    58 
       
    59     /**
       
    60      * Use serialVersionUID from JDK 1.4 for interoperability.
       
    61      */
    57     private static final long serialVersionUID = 4660359192078689545L;
    62     private static final long serialVersionUID = 4660359192078689545L;
    58 
    63 
    59     /**
    64     /**
    60      * Constructs a new job name attribute with the given job name and locale.
    65      * Constructs a new job name attribute with the given job name and locale.
    61      *
    66      *
    62      * @param  jobName  Job name.
    67      * @param  jobName job name
    63      * @param  locale   Natural language of the text string. null
    68      * @param  locale natural language of the text string. {@code null} is
    64      * is interpreted to mean the default locale as returned
    69      *         interpreted to mean the default locale as returned by
    65      * by {@code Locale.getDefault()}
    70      *         {@code Locale.getDefault()}
    66      *
    71      * @throws NullPointerException if {@code jobName} is {@code null}
    67      * @exception  NullPointerException
       
    68      *     (unchecked exception) Thrown if {@code jobName} is null.
       
    69      */
    72      */
    70     public JobName(String jobName, Locale locale) {
    73     public JobName(String jobName, Locale locale) {
    71         super (jobName, locale);
    74         super (jobName, locale);
    72     }
    75     }
    73 
    76 
    74     /**
    77     /**
    75      * Returns whether this job name attribute is equivalent to the passed in
    78      * Returns whether this job name attribute is equivalent to the passed in
    76      * object. To be equivalent, all of the following conditions must be true:
    79      * object. To be equivalent, all of the following conditions must be true:
    77      * <OL TYPE=1>
    80      * <ol type=1>
    78      * <LI>
    81      *   <li>{@code object} is not {@code null}.
    79      * {@code object} is not null.
    82      *   <li>{@code object} is an instance of class {@code JobName}.
    80      * <LI>
    83      *   <li>This job name attribute's underlying string and {@code object}'s
    81      * {@code object} is an instance of class JobName.
    84      *   underlying string are equal.
    82      * <LI>
    85      *   <li>This job name attribute's locale and {@code object}'s locale are
    83      * This job name attribute's underlying string and {@code object}'s
    86      *   equal.
    84      * underlying string are equal.
    87      * </ol>
    85      * <LI>
       
    86      * This job name attribute's locale and {@code object}'s locale are
       
    87      * equal.
       
    88      * </OL>
       
    89      *
    88      *
    90      * @param  object  Object to compare to.
    89      * @param  object {@code Object} to compare to
    91      *
    90      * @return {@code true} if {@code object} is equivalent to this job name
    92      * @return  True if {@code object} is equivalent to this job name
    91      *         attribute, {@code false} otherwise
    93      *          attribute, false otherwise.
       
    94      */
    92      */
    95     public boolean equals(Object object) {
    93     public boolean equals(Object object) {
    96         return (super.equals(object) && object instanceof JobName);
    94         return (super.equals(object) && object instanceof JobName);
    97     }
    95     }
    98 
    96 
    99     /**
    97     /**
   100      * Get the printing attribute class which is to be used as the "category"
    98      * Get the printing attribute class which is to be used as the "category"
   101      * for this printing attribute value.
    99      * for this printing attribute value.
   102      * <P>
   100      * <p>
   103      * For class JobName, the category is class JobName itself.
   101      * For class {@code JobName}, the category is class {@code JobName} itself.
   104      *
   102      *
   105      * @return  Printing attribute class (category), an instance of class
   103      * @return printing attribute class (category), an instance of class
   106      *          {@link java.lang.Class java.lang.Class}.
   104      *         {@link Class java.lang.Class}
   107      */
   105      */
   108     public final Class<? extends Attribute> getCategory() {
   106     public final Class<? extends Attribute> getCategory() {
   109         return JobName.class;
   107         return JobName.class;
   110     }
   108     }
   111 
   109 
   112     /**
   110     /**
   113      * Get the name of the category of which this attribute value is an
   111      * Get the name of the category of which this attribute value is an
   114      * instance.
   112      * instance.
   115      * <P>
   113      * <p>
   116      * For class JobName, the category name is {@code "job-name"}.
   114      * For class {@code JobName}, the category name is {@code "job-name"}.
   117      *
   115      *
   118      * @return  Attribute category name.
   116      * @return attribute category name
   119      */
   117      */
   120     public final String getName() {
   118     public final String getName() {
   121         return "job-name";
   119         return "job-name";
   122     }
   120     }
   123 
       
   124 }
   121 }