JavaTM Platform
Standard Ed. 6

javax.print.attribute.standard
类 PrinterName

java.lang.Object
  继承者 javax.print.attribute.TextSyntax
      继承者 javax.print.attribute.standard.PrinterName
所有已实现的接口:
Serializable, Cloneable, Attribute, PrintServiceAttribute

public final class PrinterName
extends TextSyntax
implements PrintServiceAttribute

PrinterName 类是打印属性类,它是一种文本属性,指定了打印机的名称。与其说它是一个 URI,倒不如说它是一个最终用户友好的名称。管理员可以确定打印机的名称并将此属性设置为该名称。此名称可以是打印机 URI 的最后部分,也可以与其无关。在非美式英语语言环境中,名称可以包含那些在 URI 中不允许的字符。

IPP 兼容性:字符串值提供了 IPP 名称值。语言环境提供了 IPP 自然语言。由 getName() 返回的类别名称提供了 IPP 属性名称。

另请参见:
序列化表格

构造方法摘要
PrinterName(String printerName, Locale locale)
          构造具有给定名称和语言环境的新 PrinterName 属性。
 
方法摘要
 boolean equals(Object object)
          返回此 PrinterName 属性是否等效于传入的对象。
 Class<? extends Attribute> getCategory()
          获取将用作此打印属性值的“类别”的打印属性类。
 String getName()
          获取类别的名称,此属性值是该类别的一个实例。
 
从类 javax.print.attribute.TextSyntax 继承的方法
getLocale, getValue, hashCode, toString
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

PrinterName

public PrinterName(String printerName,
                   Locale locale)
构造具有给定名称和语言环境的新 PrinterName 属性。

参数:
printerName - 打印机名称。
locale - 文本字符串的自然语言。将 null 解释为默认的语言环境,这是 Locale.getDefault() 返回的语言环语。
抛出:
NullPointerException - (未经检查的异常)如果 printerName 为 null,则抛出该异常。
方法详细信息

equals

public boolean equals(Object object)
返回此 PrinterName 属性是否等效于传入的对象。若要等效,以下所有条件都必须为 true:
  1. object 不为 null。
  2. object 是类 PrinterName 的一个实例。
  3. 此 PrinterName 属性的底层字符串和 object 的底层字符串相等。
  4. 此 PrinterName 属性的语言环境和 object 的语言环境相等。

覆盖:
TextSyntax 中的 equals
参数:
object - 要比较的对象。
返回:
如果 object 等效于此 PrinterName 属性,则返回 True,否则返回 false。
另请参见:
Object.hashCode(), Hashtable

getCategory

public final Class<? extends Attribute> getCategory()
获取将用作此打印属性值的“类别”的打印属性类。

对于类 PrinterName,该类别就是类 PrinterName 本身。

指定者:
接口 Attribute 中的 getCategory
返回:
打印属性类(类别),这是类 java.lang.Class 的一个实例。

getName

public final String getName()
获取类别的名称,此属性值是该类别的一个实例。

对于类 PrinterName,类别名称是 "printer-name"

指定者:
接口 Attribute 中的 getName
返回:
属性类别名称。

JavaTM Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策