public final class AttributeSetUtilities extends Object
AttributeSetUtilities
provides static methods for manipulating AttributeSets
. AttributeSet
AttributeSet
S provides a client with "read-only" access to S. Query operations on U "read through" to S; thus, changes in S are reflected in U. However, any attempt to modify U, results in an UnmodifiableSetException
. The unmodifiable view object U will be serializable if the attribute set object S is serializable. A synchronized view V of an attribute set S provides a client with synchronized (multiple thread safe) access to S. Each operation of V is synchronized using V itself as the lock object and then merely invokes the corresponding operation of S. In order to guarantee mutually exclusive access, it is critical that all access to S is accomplished through V. The synchronized view object V will be serializable if the attribute set object S is serializable.
As mentioned in the package description of javax.print
, a null
reference parameter to methods is incorrect unless explicitly documented on the method as having a meaningful interpretation. Usage to the contrary is incorrect coding and may result in a run time exception either immediately or at some later time. IllegalArgumentException
and NullPointerException
are examples of typical and acceptable run time exceptions for such cases.
Modifier and Type | Method | Description |
---|---|---|
static AttributeSet |
synchronizedView |
Creates a synchronized view of the given attribute set. |
static DocAttributeSet |
synchronizedView |
Creates a synchronized view of the given doc attribute set. |
static PrintJobAttributeSet |
synchronizedView |
Creates a synchronized view of the given print job attribute set. |
static PrintRequestAttributeSet |
synchronizedView |
Creates a synchronized view of the given print request attribute set. |
static PrintServiceAttributeSet |
synchronizedView |
Creates a synchronized view of the given print service attribute set. |
static AttributeSet |
unmodifiableView |
Creates an unmodifiable view of the given attribute set. |
static DocAttributeSet |
unmodifiableView |
Creates an unmodifiable view of the given doc attribute set. |
static PrintJobAttributeSet |
unmodifiableView |
Creates an unmodifiable view of the given print job attribute set. |
static PrintRequestAttributeSet |
unmodifiableView |
Creates an unmodifiable view of the given print request attribute set. |
static PrintServiceAttributeSet |
unmodifiableView |
Creates an unmodifiable view of the given print service attribute set. |
static Class |
verifyAttributeCategory |
|
static Attribute |
verifyAttributeValue |
Verify that the given object is an instance of the given interface, which is assumed to be interface Attribute or a subinterface thereof. |
static void |
verifyCategoryForValue |
Verify that the given attribute category object is equal to the category of the given attribute value object. |
public static AttributeSet unmodifiableView(AttributeSet attributeSet)
attributeSet
- underlying attribute setattributeSet
NullPointerException
- if attributeSet
is null
public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet)
attributeSet
- underlying doc attribute setattributeSet
NullPointerException
- if attributeSet
is null
public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet)
attributeSet
- underlying print request attribute setattributeSet
NullPointerException
- if attributeSet
is null
public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet)
attributeSet
- underlying print job attribute setattributeSet
NullPointerException
- if attributeSet
is null
public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet)
attributeSet
- underlying print service attribute setattributeSet
NullPointerException
- if attributeSet
is null
public static AttributeSet synchronizedView(AttributeSet attributeSet)
attributeSet
- underlying attribute setattributeSet
NullPointerException
- if attributeSet
is null
public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet)
attributeSet
- underlying doc attribute setattributeSet
NullPointerException
- if attributeSet
is null
public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet)
attributeSet
- underlying print request attribute setattributeSet
NullPointerException
- if attributeSet
is null
public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet)
attributeSet
- underlying print job attribute setattributeSet
NullPointerException
- if attributeSet
is null
public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet)
attributeSet
- underlying print service attribute setattributeSet
NullPointerException
- if attributeSet
is null
public static Class<?> verifyAttributeCategory(Object object, Class<?> interfaceName)
Class
that implements the given interface, which is assumed to be interface Attribute
or a subinterface thereof.object
- Object
to testinterfaceName
- interface the object must implementobject
is a Class
that implements interfaceName
, object
is returned downcast to type Class
; otherwise an exception is thrownNullPointerException
- if object
is null
ClassCastException
- if object
is not a Class
that implements interfaceName
public static Attribute verifyAttributeValue(Object object, Class<?> interfaceName)
Attribute
or a subinterface thereof.object
- Object
to testinterfaceName
- interface of which the object must be an instanceobject
is an instance of interfaceName
, object
is returned downcast to type Attribute
; otherwise an exception is thrownNullPointerException
- if object
is null
ClassCastException
- if object
is not an instance of interfaceName
public static void verifyCategoryForValue(Class<?> category, Attribute attribute)
category
- attribute category to testattribute
- attribute value to testNullPointerException
- if the category
or attribute
are null
IllegalArgumentException
- if the category
is not equal to the category of the attribute
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/print/attribute/AttributeSetUtilities.html