javax.print.attribute

Class AttributeSetUtilities


  • public final class AttributeSetUtilities
    extends Object
    Class AttributeSetUtilities provides static methods for manipulating AttributeSets.
    • Methods for creating unmodifiable and synchronized views of attribute sets.
    • operations useful for building implementations of interface AttributeSet

    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.

    • Method Detail

      • unmodifiableView

        public static AttributeSet unmodifiableView(AttributeSet attributeSet)
        Creates an unmodifiable view of the given attribute set.
        Parameters:
        attributeSet - Underlying attribute set.
        Returns:
        Unmodifiable view of attributeSet.
        Throws:
        NullPointerException - Thrown if attributeSet is null. Null is never a
      • unmodifiableView

        public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet)
        Creates an unmodifiable view of the given doc attribute set.
        Parameters:
        attributeSet - Underlying doc attribute set.
        Returns:
        Unmodifiable view of attributeSet.
        Throws:
        NullPointerException - Thrown if attributeSet is null.
      • unmodifiableView

        public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet)
        Creates an unmodifiable view of the given print request attribute set.
        Parameters:
        attributeSet - Underlying print request attribute set.
        Returns:
        Unmodifiable view of attributeSet.
        Throws:
        NullPointerException - Thrown if attributeSet is null.
      • unmodifiableView

        public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet)
        Creates an unmodifiable view of the given print job attribute set.
        Parameters:
        attributeSet - Underlying print job attribute set.
        Returns:
        Unmodifiable view of attributeSet.
        Throws:
        NullPointerException - Thrown if attributeSet is null.
      • unmodifiableView

        public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet)
        Creates an unmodifiable view of the given print service attribute set.
        Parameters:
        attributeSet - Underlying print service attribute set.
        Returns:
        Unmodifiable view of attributeSet.
        Throws:
        NullPointerException - Thrown if attributeSet is null.
      • synchronizedView

        public static AttributeSet synchronizedView(AttributeSet attributeSet)
        Creates a synchronized view of the given attribute set.
        Parameters:
        attributeSet - Underlying attribute set.
        Returns:
        Synchronized view of attributeSet.
        Throws:
        NullPointerException - Thrown if attributeSet is null.
      • synchronizedView

        public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet)
        Creates a synchronized view of the given doc attribute set.
        Parameters:
        attributeSet - Underlying doc attribute set.
        Returns:
        Synchronized view of attributeSet.
        Throws:
        NullPointerException - Thrown if attributeSet is null.
      • synchronizedView

        public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet)
        Creates a synchronized view of the given print request attribute set.
        Parameters:
        attributeSet - Underlying print request attribute set.
        Returns:
        Synchronized view of attributeSet.
        Throws:
        NullPointerException - Thrown if attributeSet is null.
      • synchronizedView

        public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet)
        Creates a synchronized view of the given print job attribute set.
        Parameters:
        attributeSet - Underlying print job attribute set.
        Returns:
        Synchronized view of attributeSet.
        Throws:
        NullPointerException - Thrown if attributeSet is null.
      • synchronizedView

        public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet)
        Creates a synchronized view of the given print service attribute set.
        Parameters:
        attributeSet - Underlying print service attribute set.
        Returns:
        Synchronized view of attributeSet.
      • verifyAttributeCategory

        public static Class<?> verifyAttributeCategory(Object object,
                                       Class<?> 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.
        Parameters:
        object - Object to test.
        interfaceName - Interface the object must implement.
        Returns:
        If object is a Class that implements interfaceName, object is returned downcast to type Class; otherwise an exception is thrown.
        Throws:
        NullPointerException - (unchecked exception) Thrown if object is null.
        ClassCastException - (unchecked exception) Thrown if object is not a Class that implements interfaceName.
      • verifyAttributeValue

        public static Attribute verifyAttributeValue(Object object,
                                     Class<?> interfaceName)
        Verify that the given object is an instance of the given interface, which is assumed to be interface Attribute or a subinterface thereof.
        Parameters:
        object - Object to test.
        interfaceName - Interface of which the object must be an instance.
        Returns:
        If object is an instance of interfaceName, object is returned downcast to type Attribute; otherwise an exception is thrown.
        Throws:
        NullPointerException - (unchecked exception) Thrown if object is null.
        ClassCastException - (unchecked exception) Thrown if object is not an instance of interfaceName.
      • verifyCategoryForValue

        public static void verifyCategoryForValue(Class<?> category,
                                  Attribute attribute)
        Verify that the given attribute category object is equal to the category of the given attribute value object. If so, this method returns doing nothing. If not, this method throws an exception.
        Parameters:
        category - Attribute category to test.
        attribute - Attribute value to test.
        Throws:
        NullPointerException - (unchecked exception) Thrown if the category is null or if the attribute is null.
        IllegalArgumentException - (unchecked exception) Thrown if the category is not equal to the category of the attribute.

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/print/attribute/attributesetutilities.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut