- java.lang.Object
 -  
      
- javax.print.attribute.AttributeSetUtilities
 
 
-  
       
public final class AttributeSetUtilities extends Object
Class AttributeSetUtilities提供用于操作AttributeSets的静态方法。- 创建属性集的不可修改和同步视图的方法。
 -  用于构建接口
AttributeSet的实现的操作 
AttributeSet 一个不可修改的视图 U为客户端提供了对S的 “只读”访问权限。 查询操作U “通读”到S ; 因此, S中的变化反映在U中 。 但是,任何修改U的尝试都会导致UnmodifiableSetException异常。 如果属性集对象S是可序列化的,则不可修改的视图对象U将是可序列化的。
属性集 同步视图 V为客户端提供了同步(多线程安全)对S的访问。 V的每个操作都使用V本身作为锁定对象进行同步,然后仅调用S的相应操作。 为了保证互相访问,通过V完成对S的所有访问都是至关重要的。 如果属性集对象S是可序列化的,则同步视图对象V将是可序列化的。
如javax.print的包描述中所述,方法的空引用参数是不正确的,除非在方法中明确记录为具有有意义的解释。 使用相反的是错误的编码,可能会立即或稍后导致运行时异常。 IllegalArgumentException和NullPointerException是这种情况的典型和可接受的运行时间异常的示例。
 
-  
        
       
-  
             
方法摘要
 
 -  
             
 
-  
        
       
-  
             
方法详细信息
-  
unmodifiableView
public static AttributeSet unmodifiableView(AttributeSet attributeSet)
创建给定属性集的不可修改的视图。- 参数
 -  
              
attributeSet- 基础属性集。 - 结果
 -  
              
attributeSet修改的视图attributeSet。 - 异常
 -  
              
NullPointerException- 如果attributeSet为空,则抛出。 空不是一个 
 
-  
unmodifiableView
public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet)
创建给定doc属性集的不可修改的视图。- 参数
 -  
              
attributeSet- 基础doc属性集。 - 结果
 -  
              
attributeSet修改的视图attributeSet。 - 异常
 -  
              
NullPointerException- 如果attributeSet为空,则抛出。 
 
-  
unmodifiableView
public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet)
创建给定打印请求属性集的不可修改的视图。- 参数
 -  
              
attributeSet- 底层打印请求属性集。 - 结果
 -  
              
attributeSet修改的视图attributeSet。 - 异常
 -  
              
NullPointerException- 如果attributeSet为空,则抛出。 
 
-  
unmodifiableView
public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet)
创建给定打印作业属性集的不可修改的视图。- 参数
 -  
              
attributeSet- 底层打印作业属性集。 - 结果
 -  
              
attributeSet修改的视图。 - 异常
 -  
              
NullPointerException- 如果attributeSet为空,则抛出。 
 
-  
unmodifiableView
public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet)
创建给定打印服务属性集的不可修改的视图。- 参数
 -  
              
attributeSet- 底层打印服务属性集。 - 结果
 -  
              
attributeSet修改的视图attributeSet。 - 异常
 -  
              
NullPointerException- 如果attributeSet为空,则抛出。 
 
-  
synchronizedView
public static AttributeSet synchronizedView(AttributeSet attributeSet)
创建给定属性集的同步视图。- 参数
 -  
              
attributeSet- 基础属性集。 - 结果
 -  
              
attributeSet同步视图。 - 异常
 -  
              
NullPointerException- 如果attributeSet为空,则抛出。 
 
-  
synchronizedView
public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet)
创建给定doc属性集的同步视图。- 参数
 -  
              
attributeSet- 基础doc属性集。 - 结果
 - 
               同步视图 
              
attributeSet。 - 异常
 -  
              
NullPointerException- 如果attributeSet为空,则抛出。 
 
-  
synchronizedView
public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet)
创建给定打印请求属性集的同步视图。- 参数
 -  
              
attributeSet- 底层打印请求属性集。 - 结果
 - 
               同步视图 
              
attributeSet。 - 异常
 -  
              
NullPointerException- 如果attributeSet为空,则抛出。 
 
-  
synchronizedView
public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet)
创建给定打印作业属性集的同步视图。- 参数
 -  
              
attributeSet- 底层打印作业属性集。 - 结果
 -  
              
attributeSet同步视图。 - 异常
 -  
              
NullPointerException- 如果attributeSet为空,则抛出。 
 
-  
synchronizedView
public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet)
创建给定打印服务属性集的同步视图。- 参数
 -  
              
attributeSet- 底层打印服务属性集。 - 结果
 -  
              
attributeSet同步视图。 
 
-  
verifyAttributeCategory
public static Class<?> verifyAttributeCategory(Object object, Class<?> interfaceName)
- 参数
 -  
              
object- 测试对象。 -  
              
interfaceName- 对象必须实现的接口。 - 结果
 -  
              如果
object是Class实现interfaceName,object返回垂头丧气键入Class; 否则抛出异常。 - 异常
 -  
              
NullPointerException- (未经检查的异常)如果object为空,则抛出。 -  
              
ClassCastException- (未经检查的异常)抛出object不是Class实现interfaceName。 
 
-  
verifyAttributeValue
public static Attribute verifyAttributeValue(Object object, Class<?> interfaceName)
验证给定对象是给定接口的一个实例,该接口被假定为接口Attribute或其子接口。- 参数
 -  
              
object- 要测试的对象。 -  
              
interfaceName- 对象必须是实例的接口。 - 结果
 -  
              如果
object是实例interfaceName,object返回垂头丧气输入Attribute; 否则抛出异常。 - 异常
 -  
              
NullPointerException- (未经检查的异常)如果object为空,则抛出。 -  
              
ClassCastException- (未经检查的异常)如果摔出object不是一个实例interfaceName。 
 
-  
verifyCategoryForValue
public static void verifyCategoryForValue(Class<?> category, Attribute attribute)
验证给定的属性类别对象是否等于给定属性值对象的类别。 如果是这样,这个方法返回什么也不做。 如果没有,这个方法会抛出异常。- 参数
 -  
              
category- 要测试的属性类别。 -  
              
attribute- 要测试的属性值。 - 异常
 -  
              
NullPointerException- (未经检查的异常)如果category为空或attribute为空,则抛出。 -  
              
IllegalArgumentException- (未经检查的异常)如果category不等于category的类别,则attribute。 
 
 -  
 
 -