所有类


javax.print.attribute
类 AttributeSetUtilities

java.lang.Object
  继承者 javax.print.attribute.AttributeSetUtilities

public final class AttributeSetUtilities
   
   
   
   
   
extends Object

类 AttributeSetUtilities 为操作 AttributeSets 提供静态方法。

  • 用于创建属性集的不可修改的同步视图的方法。
  • 用于构建接口 AttributeSet 的实现的操作。

AttributeSet S不可修改的视图U 为客户机提供对 S 的“只读”访问。U 上的查询操作“遍历”S;因此,S 中的更改会反映在 U 中。但是,任何修改 U 的尝试都会导致 UnmodifiableSetException。如果属性集对象 S 是可序列化的,则不可修改的视图对象 U 将是可序列化的。

属性集 S同步视图V 为客户机提供对 S 的同步(多线程安全)访问。V 的每个操作使用 V 本身作为锁定对象进行同步,然后只调用 S 的相应操作。为了相互保证独占访问,通过 V 完成对 S 的所有访问非常重要。如果属性集对象 S 是可序列化的,则同步视图对象 V 将是可序列化的。

如 javax.print 的包描述中提及的那样,方法的 null 引用参数是不正确的,除非在该方法中将该参数明确记录为具有有意义的解释。与之相反的用法是不正确的编码,可能立即或在稍后某一时间导致运行时异常。IllegalArgumentException 和 NullPointerException 是针对这种情况的典型的、可接受的运行时异常的示例。


方法摘要
static AttributeSetsynchronizedView(AttributeSet attributeSet)
          创建给定属性集的同步视图。
static DocAttributeSetsynchronizedView(DocAttributeSet attributeSet)
          创建一个给定文档属性集的同步视图。
static PrintJobAttributeSetsynchronizedView(PrintJobAttributeSet attributeSet)
          创建一个给定打印作业属性集的同步视图。
static PrintRequestAttributeSetsynchronizedView(PrintRequestAttributeSet attributeSet)
          创建一个给定打印请求属性集的同步视图。
static PrintServiceAttributeSetsynchronizedView(PrintServiceAttributeSet attributeSet)
          创建一个给定打印服务属性集的同步视图。
static AttributeSetunmodifiableView(AttributeSet attributeSet)
          创建给定属性集的不可修改的视图。
static DocAttributeSetunmodifiableView(DocAttributeSet attributeSet)
          创建一个给定文档属性集的不可修改的视图。
static PrintJobAttributeSetunmodifiableView(PrintJobAttributeSet attributeSet)
          创建一个给定打印作业属性集的不可修改的视图。
static PrintRequestAttributeSetunmodifiableView(PrintRequestAttributeSet attributeSet)
          创建一个给定打印请求属性集的不可修改的视图。
static PrintServiceAttributeSetunmodifiableView(PrintServiceAttributeSet attributeSet)
          创建一个给定打印服务属性集的不可修改的视图。
static Class<?>verifyAttributeCategory(Object object, Class<?> interfaceName)
          验证给定的对象是否为实现给定接口(假定为接口 Attribute 或其子接口)的 Class
static AttributeverifyAttributeValue(Object object, Class<?> interfaceName)
          验证给定的对象是否为给定接口(假定为接口 Attribute 或其子接口)的一个实例。
static voidverifyCategoryForValue(Class<?> category, Attribute attribute)
          验证给定的属性类别对象是否等于给定属性值对象的类别。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

unmodifiableView

public static AttributeSet unmodifiableView(AttributeSet attributeSet)
创建给定属性集的不可修改的视图。

参数:
attributeSet - 基础属性集。
返回:
attributeSet 的不可修改的视图。
抛出:
NullPointerException - 如果 attributeSet 为 null,则抛出该异常。

unmodifiableView

public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet)
创建一个给定文档属性集的不可修改的视图。

参数:
attributeSet - 基础文档属性集。
返回:
attributeSet 的不可修改的视图。
抛出:
NullPointerException - 如果 attributeSet 为 null,则抛出该异常。

unmodifiableView

public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet)
创建一个给定打印请求属性集的不可修改的视图。

参数:
attributeSet - 基础打印请求属性集。
返回:
attributeSet 的不可修改的视图。
抛出:
NullPointerException - 如果 attributeSet 为 null,则抛出该异常。

unmodifiableView

public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet)
创建一个给定打印作业属性集的不可修改的视图。

参数:
attributeSet - 基础打印作业属性集。
返回:
attributeSet 的不可修改的视图。
抛出:
NullPointerException - 如果 attributeSet 为 null,则抛出该异常。

unmodifiableView

public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet)
创建一个给定打印服务属性集的不可修改的视图。

参数:
attributeSet - 基础打印服务属性集。
返回:
attributeSet 的不可修改的视图。
抛出:
NullPointerException - 如果 attributeSet 为 null,则抛出该异常。

synchronizedView

public static AttributeSet synchronizedView(AttributeSet attributeSet)
创建给定属性集的同步视图。

参数:
attributeSet - 基础属性集。
返回:
attributeSet 的同步视图。
抛出:
NullPointerException - 如果 attributeSet 为 null,则抛出该异常。

synchronizedView

public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet)
创建一个给定文档属性集的同步视图。

参数:
attributeSet - 基础文档属性集。
返回:
attributeSet 的同步视图。
抛出:
NullPointerException - 如果 attributeSet 为 null,则抛出该异常。