001 /*
002 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.print.attribute.standard;
026
027 import java.util.Locale;
028
029 import javax.print.attribute.Attribute;
030 import javax.print.attribute.TextSyntax;
031 import javax.print.attribute.PrintJobAttribute;
032
033 /**
034 * Class JobMessageFromOperator is a printing attribute class, a text attribute,
035 * that provides a message from an operator, system administrator, or
036 * "intelligent" process to indicate to the end user the reasons for
037 * modification or other management action taken on a job.
038 * <P>
039 * A Print Job's attribute set includes zero instances or one instance of a
040 * JobMessageFromOperator attribute, not more than one instance. A new
041 * JobMessageFromOperator attribute replaces an existing JobMessageFromOperator
042 * attribute, if any. In other words, JobMessageFromOperator is not intended to
043 * be a history log. If it wishes, the client can detect changes to a Print
044 * Job's JobMessageFromOperator attribute and maintain the client's own history
045 * log of the JobMessageFromOperator attribute values.
046 * <P>
047 * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
048 * locale gives the IPP natural language. The category name returned by
049 * <CODE>getName()</CODE> gives the IPP attribute name.
050 * <P>
051 *
052 * @author Alan Kaminsky
053 */
054 public final class JobMessageFromOperator extends TextSyntax implements
055 PrintJobAttribute {
056
057 private static final long serialVersionUID = -4620751846003142047L;
058
059 /**
060 * Constructs a new job message from operator attribute with the given
061 * message and locale.
062 *
063 * @param message Message.
064 * @param locale Natural language of the text string. null
065 * is interpreted to mean the default locale as returned
066 * by <code>Locale.getDefault()</code>
067 *
068 * @exception NullPointerException
069 * (unchecked exception) Thrown if <CODE>message</CODE> is null.
070 */
071 public JobMessageFromOperator(String message, Locale locale) {
072 super (message, locale);
073 }
074
075 /**
076 * Returns whether this job message from operator attribute is equivalent to
077 * the passed in object. To be equivalent, all of the following conditions
078 * must be true:
079 * <OL TYPE=1>
080 * <LI>
081 * <CODE>object</CODE> is not null.
082 * <LI>
083 * <CODE>object</CODE> is an instance of class JobMessageFromOperator.
084 * <LI>
085 * This job message from operator attribute's underlying string and
086 * <CODE>object</CODE>'s underlying string are equal.
087 * <LI>
088 * This job message from operator attribute's locale and
089 * <CODE>object</CODE>'s locale are equal.
090 * </OL>
091 *
092 * @param object Object to compare to.
093 *
094 * @return True if <CODE>object</CODE> is equivalent to this job
095 * message from operator attribute, false otherwise.
096 */
097 public boolean equals(Object object) {
098 return (super .equals(object) && object instanceof JobMessageFromOperator);
099 }
100
101 /**
102 * Get the printing attribute class which is to be used as the "category"
103 * for this printing attribute value.
104 * <P>
105 * For class JobMessageFromOperator, the
106 * category is class JobMessageFromOperator itself.
107 *
108 * @return Printing attribute class (category), an instance of class
109 * {@link java.lang.Class java.lang.Class}.
110 */
111 public final Class<? extends Attribute> getCategory() {
112 return JobMessageFromOperator.class;
113 }
114
115 /**
116 * Get the name of the category of which this attribute value is an
117 * instance.
118 * <P>
119 * For class JobMessageFromOperator, the
120 * category name is <CODE>"job-message-from-operator"</CODE>.
121 *
122 * @return Attribute category name.
123 */
124 public final String getName() {
125 return "job-message-from-operator";
126 }
127
128 }
|