< prev index next >

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

Print this page




  30 import javax.print.attribute.TextSyntax;
  31 import javax.print.attribute.PrintRequestAttribute;
  32 import javax.print.attribute.PrintJobAttribute;
  33 
  34 /**
  35  * Class JobName is a printing attribute class, a text attribute, that specifies
  36  * the name of a print job. A job's name is an arbitrary string defined by the
  37  * client. It does not need to be unique between different jobs. A Print Job's
  38  * JobName attribute is set to the value supplied by the client in the Print
  39  * Request's attribute set. If, however, the client does not supply a JobName
  40  * attribute in the Print Request, the printer, when it creates the Print Job,
  41  * must generate a JobName. The printer should generate the value of the Print
  42  * Job's JobName attribute from the first of the following sources that produces
  43  * a value: (1) the {@link DocumentName DocumentName} attribute of the first (or
  44  * only) doc in the job, (2) the URL of the first (or only) doc in the job, if
  45  * the doc's print data representation object is a URL, or (3) any other piece
  46  * of Print Job specific and/or document content information.
  47  * <P>
  48  * <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
  50  * <CODE>getName()</CODE> gives the IPP attribute name.
  51  *
  52  * @author  Alan Kaminsky
  53  */
  54 public final class JobName extends TextSyntax
  55         implements PrintRequestAttribute, PrintJobAttribute {
  56 
  57     private static final long serialVersionUID = 4660359192078689545L;
  58 
  59     /**
  60      * Constructs a new job name attribute with the given job name and locale.
  61      *
  62      * @param  jobName  Job name.
  63      * @param  locale   Natural language of the text string. null
  64      * is interpreted to mean the default locale as returned
  65      * by <code>Locale.getDefault()</code>
  66      *
  67      * @exception  NullPointerException
  68      *     (unchecked exception) Thrown if <CODE>jobName</CODE> is null.
  69      */
  70     public JobName(String jobName, Locale locale) {
  71         super (jobName, locale);
  72     }
  73 
  74     /**
  75      * 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:
  77      * <OL TYPE=1>
  78      * <LI>
  79      * <CODE>object</CODE> is not null.
  80      * <LI>
  81      * <CODE>object</CODE> is an instance of class JobName.
  82      * <LI>
  83      * This job name attribute's underlying string and <CODE>object</CODE>'s
  84      * underlying string are equal.
  85      * <LI>
  86      * This job name attribute's locale and <CODE>object</CODE>'s locale are
  87      * equal.
  88      * </OL>
  89      *
  90      * @param  object  Object to compare to.
  91      *
  92      * @return  True if <CODE>object</CODE> is equivalent to this job name
  93      *          attribute, false otherwise.
  94      */
  95     public boolean equals(Object object) {
  96         return (super.equals(object) && object instanceof JobName);
  97     }
  98 
  99     /**
 100      * Get the printing attribute class which is to be used as the "category"
 101      * for this printing attribute value.
 102      * <P>
 103      * For class JobName, the category is class JobName itself.
 104      *
 105      * @return  Printing attribute class (category), an instance of class
 106      *          {@link java.lang.Class java.lang.Class}.
 107      */
 108     public final Class<? extends Attribute> getCategory() {
 109         return JobName.class;
 110     }
 111 
 112     /**
 113      * Get the name of the category of which this attribute value is an
 114      * instance.
 115      * <P>
 116      * For class JobName, the category name is <CODE>"job-name"</CODE>.
 117      *
 118      * @return  Attribute category name.
 119      */
 120     public final String getName() {
 121         return "job-name";
 122     }
 123 
 124 }


  30 import javax.print.attribute.TextSyntax;
  31 import javax.print.attribute.PrintRequestAttribute;
  32 import javax.print.attribute.PrintJobAttribute;
  33 
  34 /**
  35  * Class JobName is a printing attribute class, a text attribute, that specifies
  36  * the name of a print job. A job's name is an arbitrary string defined by the
  37  * client. It does not need to be unique between different jobs. A Print Job's
  38  * JobName attribute is set to the value supplied by the client in the Print
  39  * Request's attribute set. If, however, the client does not supply a JobName
  40  * attribute in the Print Request, the printer, when it creates the Print Job,
  41  * must generate a JobName. The printer should generate the value of the Print
  42  * Job's JobName attribute from the first of the following sources that produces
  43  * a value: (1) the {@link DocumentName DocumentName} attribute of the first (or
  44  * only) doc in the job, (2) the URL of the first (or only) doc in the job, if
  45  * the doc's print data representation object is a URL, or (3) any other piece
  46  * of Print Job specific and/or document content information.
  47  * <P>
  48  * <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
  50  * {@code getName()} gives the IPP attribute name.
  51  *
  52  * @author  Alan Kaminsky
  53  */
  54 public final class JobName extends TextSyntax
  55         implements PrintRequestAttribute, PrintJobAttribute {
  56 
  57     private static final long serialVersionUID = 4660359192078689545L;
  58 
  59     /**
  60      * Constructs a new job name attribute with the given job name and locale.
  61      *
  62      * @param  jobName  Job name.
  63      * @param  locale   Natural language of the text string. null
  64      * is interpreted to mean the default locale as returned
  65      * by {@code Locale.getDefault()}
  66      *
  67      * @exception  NullPointerException
  68      *     (unchecked exception) Thrown if {@code jobName} is null.
  69      */
  70     public JobName(String jobName, Locale locale) {
  71         super (jobName, locale);
  72     }
  73 
  74     /**
  75      * 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:
  77      * <OL TYPE=1>
  78      * <LI>
  79      * {@code object} is not null.
  80      * <LI>
  81      * {@code object} is an instance of class JobName.
  82      * <LI>
  83      * This job name attribute's underlying string and {@code object}'s
  84      * underlying string are equal.
  85      * <LI>
  86      * This job name attribute's locale and {@code object}'s locale are
  87      * equal.
  88      * </OL>
  89      *
  90      * @param  object  Object to compare to.
  91      *
  92      * @return  True if {@code object} is equivalent to this job name
  93      *          attribute, false otherwise.
  94      */
  95     public boolean equals(Object object) {
  96         return (super.equals(object) && object instanceof JobName);
  97     }
  98 
  99     /**
 100      * Get the printing attribute class which is to be used as the "category"
 101      * for this printing attribute value.
 102      * <P>
 103      * For class JobName, the category is class JobName itself.
 104      *
 105      * @return  Printing attribute class (category), an instance of class
 106      *          {@link java.lang.Class java.lang.Class}.
 107      */
 108     public final Class<? extends Attribute> getCategory() {
 109         return JobName.class;
 110     }
 111 
 112     /**
 113      * Get the name of the category of which this attribute value is an
 114      * instance.
 115      * <P>
 116      * For class JobName, the category name is {@code "job-name"}.
 117      *
 118      * @return  Attribute category name.
 119      */
 120     public final String getName() {
 121         return "job-name";
 122     }
 123 
 124 }
< prev index next >