Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java
38918 views
/*1* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/242526package javax.print.attribute;2728/**29* Interface PrintRequestAttributeSet specifies the interface for a set of30* print request attributes, i.e. printing attributes that implement interface31* {@link PrintRequestAttribute PrintRequestAttribute}.32* The client uses a PrintRequestAttributeSet to specify the settings to be33* applied to a whole print job and to all the docs in the print job.34* <P>35* PrintRequestAttributeSet is just an {@link AttributeSet AttributeSet} whose36* constructors and mutating operations guarantee an additional invariant,37* namely that all attribute values in the PrintRequestAttributeSet must be38* instances of interface {@link PrintRequestAttribute PrintRequestAttribute}.39* The {@link #add(Attribute) add(Attribute)}, and40* {@link #addAll(AttributeSet) addAll(AttributeSet)} operations41* are respecified below to guarantee this additional invariant.42* <P>43*44* @author Alan Kaminsky45*/46public interface PrintRequestAttributeSet extends AttributeSet {4748/**49* Adds the specified attribute value to this attribute set if it is not50* already present, first removing any existing value in the same51* attribute category as the specified attribute value (optional52* operation).53*54* @param attribute Attribute value to be added to this attribute set.55*56* @return <tt>true</tt> if this attribute set changed as a result of57* the call, i.e., the given attribute value was not already a58* member of this attribute set.59*60* @throws UnmodifiableSetException61* (unchecked exception) Thrown if this attribute set does not62* support the <CODE>add()</CODE> operation.63* @throws ClassCastException64* (unchecked exception) Thrown if the <CODE>attribute</CODE> is65* not an instance of interface66* {@link PrintRequestAttribute PrintRequestAttribute}.67* @throws NullPointerException68* (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.69*/70public boolean add(Attribute attribute);7172/**73* Adds all of the elements in the specified set to this attribute.74* The outcome is the same as if the75* {@link #add(Attribute) add(Attribute)}76* operation had been applied to this attribute set successively with77* each element from the specified set. If none of the categories in the78* specified set are the same as any categories in this attribute set,79* the <tt>addAll()</tt> operation effectively modifies this attribute80* set so that its value is the <i>union</i> of the two sets.81* <P>82* The behavior of the <CODE>addAll()</CODE> operation is unspecified if83* the specified set is modified while the operation is in progress.84* <P>85* If the <CODE>addAll()</CODE> operation throws an exception, the effect86* on this attribute set's state is implementation dependent; elements87* from the specified set before the point of the exception may or88* may not have been added to this attribute set.89*90* @param attributes whose elements are to be added to this attribute91* set.92*93* @return <tt>true</tt> if this attribute set changed as a result of94* the call.95*96* @throws UnmodifiableSetException97* (Unchecked exception) Thrown if this attribute set does not98* support the <tt>addAll()</tt> method.99* @throws ClassCastException100* (Unchecked exception) Thrown if some element in the specified101* set is not an instance of interface {@link PrintRequestAttribute102* PrintRequestAttribute}.103* @throws NullPointerException104* (Unchecked exception) Thrown if the specified set is null.105*106* @see #add(Attribute)107*/108public boolean addAll(AttributeSet attributes);109110}111112113