APIdia Launch Partner
Top Description Inners Constructors Methods
javax.print.attribute

public final Class AttributeSetUtilities

extends Object
Class Inheritance
Imports
java.io.Serial, .Serializable

Class AttributeSetUtilities provides static methods for manipulating AttributeSets. An unmodifiable view U of an 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.

Author
Alan Kaminsky

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
AttributeSetUtilities.SynchronizedAttributeSet

Synchronized view of AttributeSet.

private static class
AttributeSetUtilities.SynchronizedDocAttributeSet

Synchronized view of DocAttributeSet.

private static class
AttributeSetUtilities.SynchronizedPrintJobAttributeSet

Synchronized view of PrintJobAttributeSet.

private static class
AttributeSetUtilities.SynchronizedPrintRequestAttributeSet

Synchronized view of PrintRequestAttributeSet.

private static class
AttributeSetUtilities.SynchronizedPrintServiceAttributeSet

Synchronized view of PrintServiceAttributeSet.

private static class
AttributeSetUtilities.UnmodifiableAttributeSet

Unmodifiable view of AttributeSet.

private static class
AttributeSetUtilities.UnmodifiableDocAttributeSet

Unmodifiable view of DocAttributeSet.

private static class
AttributeSetUtilities.UnmodifiablePrintJobAttributeSet

Unmodifiable view of PrintJobAttributeSet.

private static class
AttributeSetUtilities.UnmodifiablePrintRequestAttributeSet

Unmodifiable view of PrintRequestAttributeSet.

private static class
AttributeSetUtilities.UnmodifiablePrintServiceAttributeSet

Unmodifiable view of PrintServiceAttributeSet.

Constructor Summary

AccessConstructor and Description
private
AttributeSetUtilities()

Suppress default constructor, ensuring non-instantiability.

Method Summary

Modifier and TypeMethod and Description
public static AttributeSet

Returns:

synchronized view of attributeSet
synchronizedView
(AttributeSet
underlying attribute set
attributeSet
)

Creates a synchronized view of the given attribute set.

public static DocAttributeSet

Returns:

synchronized view of attributeSet
synchronizedView
(DocAttributeSet
underlying doc attribute set
attributeSet
)

Creates a synchronized view of the given doc attribute set.

public static PrintRequestAttributeSet

Returns:

synchronized view of attributeSet
synchronizedView
(PrintRequestAttributeSet
underlying print request attribute set
attributeSet
)

Creates a synchronized view of the given print request attribute set.

public static PrintJobAttributeSet

Returns:

synchronized view of attributeSet
synchronizedView
(PrintJobAttributeSet
underlying print job attribute set
attributeSet
)

Creates a synchronized view of the given print job attribute set.

public static PrintServiceAttributeSet

Returns:

synchronized view of attributeSet
synchronizedView
(PrintServiceAttributeSet
underlying print service attribute set
attributeSet
)

Creates a synchronized view of the given print service attribute set.

public static AttributeSet

Returns:

unmodifiable view of attributeSet
unmodifiableView
(AttributeSet
underlying attribute set
attributeSet
)

Creates an unmodifiable view of the given attribute set.

public static DocAttributeSet

Returns:

unmodifiable view of attributeSet
unmodifiableView
(DocAttributeSet
underlying doc attribute set
attributeSet
)

Creates an unmodifiable view of the given doc attribute set.

public static PrintRequestAttributeSet

Returns:

unmodifiable view of attributeSet
unmodifiableView
(PrintRequestAttributeSet
underlying print request attribute set
attributeSet
)

Creates an unmodifiable view of the given print request attribute set.

public static PrintJobAttributeSet

Returns:

unmodifiable view of attributeSet
unmodifiableView
(PrintJobAttributeSet
underlying print job attribute set
attributeSet
)

Creates an unmodifiable view of the given print job attribute set.

public static PrintServiceAttributeSet

Returns:

unmodifiable view of attributeSet
unmodifiableView
(PrintServiceAttributeSet
underlying print service attribute set
attributeSet
)

Creates an unmodifiable view of the given print service attribute set.

public static Class<?>

Returns:

if object is a Class that implements interfaceName, object is returned downcast to type Class; otherwise an exception is thrown
verifyAttributeCategory
(Object
Object to test
object
,
Class<?>
interface the object must implement
interfaceName
)

Verify that the given object is a Class that implements the given interface, which is assumed to be interface Attribute or a subinterface thereof.

public static Attribute

Returns:

if object is an instance of interfaceName, object is returned downcast to type Attribute; otherwise an exception is thrown
verifyAttributeValue
(Object
Object to test
object
,
Class<?>
interface of which the object must be an instance
interfaceName
)

Verify that the given object is an instance of the given interface, which is assumed to be interface Attribute or a subinterface thereof.

public static void
verifyCategoryForValue(Class<?>
attribute category to test
category
,
Attribute
attribute value to test
attribute
)

Verify that the given attribute category object is equal to the category of the given attribute value object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait