Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.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 DocAttributeSet specifies the interface for a set of doc30* attributes, i.e. printing attributes that implement interface {@link31* DocAttribute DocAttribute}. In the Print Service API, the client uses a32* DocAttributeSet to specify the characteristics of an individual doc and33* the print job settings to be applied to an individual doc.34* <P>35* A DocAttributeSet is just an {@link AttributeSet AttributeSet} whose36* constructors and mutating operations guarantee an additional invariant,37* namely that all attribute values in the DocAttributeSet must be instances38* of interface {@link DocAttribute DocAttribute}.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 DocAttributeSet extends AttributeSet {474849/**50* Adds the specified attribute value to this attribute set if it is not51* already present, first removing any existing value in the same52* attribute category as the specified attribute value (optional53* operation).54*55* @param attribute Attribute value to be added to this attribute set.56*57* @return <tt>true</tt> if this attribute set changed as a result of58* the call, i.e., the given attribute value was not already a59* member of this attribute set.60*61* @throws UnmodifiableSetException62* (unchecked exception) Thrown if this attribute set does not63* support the <CODE>add()</CODE> operation.64* @throws ClassCastException65* (unchecked exception) Thrown if the <CODE>attribute</CODE> is66* not an instance of interface67* {@link DocAttribute DocAttribute}.68* @throws NullPointerException69* (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.70*/71public boolean add(Attribute attribute);7273/**74* Adds all of the elements in the specified set to this attribute.75* The outcome is the same as if the76* {@link #add(Attribute) add(Attribute)}77* operation had been applied to this attribute set successively with78* each element from the specified set. If none of the categories in the79* specified set are the same as any categories in this attribute set,80* the <tt>addAll()</tt> operation effectively modifies this attribute81* set so that its value is the <i>union</i> of the two sets.82* <P>83* The behavior of the <CODE>addAll()</CODE> operation is unspecified if84* the specified set is modified while the operation is in progress.85* <P>86* If the <CODE>addAll()</CODE> operation throws an exception, the effect87* on this attribute set's state is implementation dependent; elements88* from the specified set before the point of the exception may or89* may not have been added to this attribute set.90*91* @param attributes whose elements are to be added to this attribute92* set.93*94* @return <tt>true</tt> if this attribute set changed as a result of95* the call.96*97* @throws UnmodifiableSetException98* (Unchecked exception) Thrown if this attribute set does not99* support the <tt>addAll()</tt> method.100* @throws ClassCastException101* (Unchecked exception) Thrown if some element in the specified102* set is not an instance of interface {@link DocAttribute103* DocAttribute}.104* @throws NullPointerException105* (Unchecked exception) Thrown if the specified set is null.106*107* @see #add(Attribute)108*/109public boolean addAll(AttributeSet attributes);110}111112113