Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.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 PrintServiceAttributeSet specifies the interface for a set of30* print job attributes, i.e. printing attributes that implement interface31* {@link32* PrintServiceAttribute PrintServiceAttribute}. In the Print Service API,33* the Print Service instance uses a PrintServiceAttributeSet to report the34* status of the print service.35* <P>36* A PrintServiceAttributeSet is just an {@link AttributeSet AttributeSet}37* whose constructors and mutating operations guarantee an additional38* invariant,39* namely that all attribute values in the PrintServiceAttributeSet must be40* instances of interface {@link PrintServiceAttribute PrintServiceAttribute}.41* The {@link #add(Attribute) add(Attribute)}, and42* {@link #addAll(AttributeSet) addAll(AttributeSet)} operations43* are respecified below to guarantee this additional invariant.44* <P>45*46* @author Alan Kaminsky47*/48public interface PrintServiceAttributeSet extends AttributeSet {49505152/**53* Adds the specified attribute value to this attribute set if it is not54* already present, first removing any existing value in the same55* attribute category as the specified attribute value (optional56* operation).57*58* @param attribute Attribute value to be added to this attribute set.59*60* @return <tt>true</tt> if this attribute set changed as a result of61* the call, i.e., the given attribute value was not already a62* member of this attribute set.63*64* @throws UnmodifiableSetException65* (unchecked exception) Thrown if this attribute set does not66* support the <CODE>add()</CODE> operation.67* @throws ClassCastException68* (unchecked exception) Thrown if the <CODE>attribute</CODE> is69* not an instance of interface70* {@link PrintServiceAttribute PrintServiceAttribute}.71* @throws NullPointerException72* (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.73*/74public boolean add(Attribute attribute);7576/**77* Adds all of the elements in the specified set to this attribute.78* The outcome is the same as if the79* {@link #add(Attribute) add(Attribute)}80* operation had been applied to this attribute set successively with81* each element from the specified set. If none of the categories in the82* specified set are the same as any categories in this attribute set,83* the <tt>addAll()</tt> operation effectively modifies this attribute84* set so that its value is the <i>union</i> of the two sets.85* <P>86* The behavior of the <CODE>addAll()</CODE> operation is unspecified if87* the specified set is modified while the operation is in progress.88* <P>89* If the <CODE>addAll()</CODE> operation throws an exception, the effect90* on this attribute set's state is implementation dependent; elements91* from the specified set before the point of the exception may or92* may not have been added to this attribute set.93*94* @param attributes whose elements are to be added to this attribute95* set.96*97* @return <tt>true</tt> if this attribute set changed as a result of98* the call.99*100* @throws UnmodifiableSetException101* (Unchecked exception) Thrown if this attribute set does not102* support the <tt>addAll()</tt> method.103* @throws ClassCastException104* (Unchecked exception) Thrown if some element in the specified105* set is not an instance of interface {@link PrintServiceAttribute106* PrintServiceAttribute}.107* @throws NullPointerException108* (Unchecked exception) Thrown if the specified set is null.109*110* @see #add(Attribute)111*/112public boolean addAll(AttributeSet attributes);113}114115116