Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/PrintServiceAttributeSet.java
41159 views
/*1* Copyright (c) 2000, 2017, 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*/2425package javax.print.attribute;2627/**28* Interface {@code PrintServiceAttributeSet} specifies the interface for a set29* of print job attributes, i.e. printing attributes that implement interface30* {@link PrintServiceAttribute PrintServiceAttribute}. In the Print Service31* API, the Print Service instance uses a {@code PrintServiceAttributeSet} to32* report the status of the print service.33* <p>34* A {@code PrintServiceAttributeSet} is just an35* {@link AttributeSet AttributeSet} whose constructors and mutating operations36* guarantee an additional invariant, namely that all attribute values in the37* {@code PrintServiceAttributeSet} must be instances of interface38* {@link PrintServiceAttribute PrintServiceAttribute}. The39* {@link #add(Attribute) add(Attribute)}, and40* {@link #addAll(AttributeSet) addAll(AttributeSet)} operations are respecified41* below to guarantee this additional invariant.42*43* @author Alan Kaminsky44*/45public interface PrintServiceAttributeSet extends AttributeSet {4647/**48* Adds the specified attribute value to this attribute set if it is not49* already present, first removing any existing value in the same attribute50* category as the specified attribute value (optional operation).51*52* @param attribute attribute value to be added to this attribute set53* @return {@code true} if this attribute set changed as a result of the54* call, i.e., the given attribute value was not already a member of55* this attribute set56* @throws UnmodifiableSetException if this attribute set does not support57* the {@code add()} operation58* @throws ClassCastException if the {@code attribute} is not an instance of59* interface {@link PrintServiceAttribute PrintServiceAttribute}60* @throws NullPointerException if the {@code attribute} is {@code null}61*/62public boolean add(Attribute attribute);6364/**65* Adds all of the elements in the specified set to this attribute. The66* outcome is the same as if the {@link #add(Attribute) add(Attribute)}67* operation had been applied to this attribute set successively with each68* element from the specified set. If none of the categories in the69* specified set are the same as any categories in this attribute set, the70* {@code addAll()} operation effectively modifies this attribute set so71* that its value is the <i>union</i> of the two sets.72* <p>73* The behavior of the {@code addAll()} operation is unspecified if the74* specified set is modified while the operation is in progress.75* <p>76* If the {@code addAll()} operation throws an exception, the effect on this77* attribute set's state is implementation dependent; elements from the78* specified set before the point of the exception may or may not have been79* added to this attribute set.80*81* @param attributes whose elements are to be added to this attribute set82* @return {@code true} if this attribute set changed as a result of the83* call84* @throws UnmodifiableSetException if this attribute set does not support85* the {@code addAll()} method86* @throws ClassCastException if some element in the specified set is not an87* instance of interface88* {@link PrintServiceAttribute PrintServiceAttribute}89* @throws NullPointerException if the specified set is {@code null}90* @see #add(Attribute)91*/92public boolean addAll(AttributeSet attributes);93}949596