java.applet

java.awt

java.awt.color

java.awt.datatransfer

java.awt.dnd

java.awt.event

java.awt.font

java.awt.geom

java.awt.im

java.awt.im.spi

java.awt.image

java.awt.image.renderable

java.awt.print

java.beans

java.beans.beancontext

java.io

java.lang

java.lang.annotation

java.lang.instrument

java.lang.management

java.lang.ref

java.lang.reflect

java.math

java.net

java.nio

java.nio.channels

java.nio.channels.spi

java.nio.charset

java.nio.charset.spi

java.rmi

java.rmi.activation

java.rmi.dgc

java.rmi.registry

java.rmi.server

java.security

java.security.acl

java.security.cert

java.security.interfaces

java.security.spec

java.sql

java.text

java.util

java.util.concurrent

java.util.concurrent.atomic

java.util.concurrent.locks

java.util.jar

java.util.logging

java.util.prefs

java.util.regex

java.util.zip

javax.accessibility

javax.activity

javax.crypto

javax.crypto.interfaces

javax.crypto.spec

javax.imageio

javax.imageio.event

javax.imageio.metadata

javax.imageio.plugins.bmp

javax.imageio.plugins.jpeg

javax.imageio.spi

javax.imageio.stream

javax.management

javax.management.loading

javax.management.modelmbean

javax.management.monitor

javax.management.openmbean

javax.management.relation

javax.management.remote

javax.management.remote.rmi

javax.management.timer

javax.naming

javax.naming.directory

javax.naming.event

javax.naming.ldap

javax.naming.spi

javax.net

javax.net.ssl

javax.print

javax.print.attribute

javax.print.attribute.standard

javax.print.event

javax.rmi

javax.rmi.CORBA

javax.rmi.ssl

javax.security.auth

javax.security.auth.callback

javax.security.auth.kerberos

javax.security.auth.login

javax.security.auth.spi

javax.security.auth.x500

javax.security.cert

javax.security.sasl

javax.sound.midi

javax.sound.midi.spi

javax.sound.sampled

javax.sound.sampled.spi

javax.sql

javax.sql.rowset

javax.sql.rowset.serial

javax.sql.rowset.spi

javax.swing

javax.swing.border

javax.swing.colorchooser

javax.swing.event

javax.swing.filechooser

javax.swing.plaf

javax.swing.plaf.basic

javax.swing.plaf.metal

javax.swing.plaf.multi

javax.swing.plaf.synth

javax.swing.table

javax.swing.text

javax.swing.text

javax.swing.text.parser

javax.swing.text.rtf

javax.swing.tree

javax.swing.undo

javax.transaction

javax.transaction.xa

javax.xml

javax.xml.datatype

javax.xml.namespace

javax.xml.parsers

javax.xml.transform

javax.xml.transform.dom

javax.xml.transform.sax

javax.xml.transform.stream

javax.xml.validation

javax.xml.xpath

org.ietf.jgss

org.omg.CORBA

org.omg.CORBA_2_3

org.omg.CORBA_2_3.portable

org.omg.CORBA.DynAnyPackage

org.omg.CORBA.ORBPackage

org.omg.CORBA.portable

org.omg.CORBA.TypeCodePackage

org.omg.CosNaming

org.omg.CosNaming.NamingContextExtPackage

org.omg.CosNaming.NamingContextPackage

org.omg.Dynamic

org.omg.DynamicAny

org.omg.DynamicAny.DynAnyFactoryPackage

org.omg.DynamicAny.DynAnyPackage

org.omg.IOP

org.omg.IOP.CodecFactoryPackage

org.omg.IOP.CodecPackage

org.omg.Messaging

org.omg.PortableInterceptor

org.omg.PortableInterceptor.ORBInitInfoPackage

org.omg.PortableServer

org.omg.PortableServer.CurrentPackage

org.omg.PortableServer.POAManagerPackage

org.omg.PortableServer.POAPackage

org.omg.PortableServer.portable

org.omg.PortableServer.ServantLocatorPackage

org.omg.SendingContext

org.omg.stub.java.rmi

org.w3c.dom

org.w3c.dom.bootstrap

org.w3c.dom.events

org.w3c.dom.ls

org.xml.sax

org.xml.sax.ext

org.xml.sax.helpers

allclasses-frame

allclasses-noframe

constant-values

deprecated-list

help-doc

JavaTM 2 Platform
Standard Ed. 5.0

javax.print.attribute
类 HashAttributeSet

java.lang.Object
  继承者 javax.print.attribute.HashAttributeSet
所有已实现的接口:
Serializable, AttributeSet
直接已知子类:
HashDocAttributeSet, HashPrintJobAttributeSet, HashPrintRequestAttributeSet, HashPrintServiceAttributeSet

public class HashAttributeSet
extends Object
implements AttributeSet, Serializable

类 HashAttributeSet 提供具有哈希映射特征的 AttributeSet 实现。

另请参见:
序列化表格

构造方法摘要
  HashAttributeSet()
          构造一个新的、空属性集。
  HashAttributeSet(Attribute attribute)
          构造一个最初使用给定属性填充的新属性集。
  HashAttributeSet(Attribute[] attributes)
          构造一个最初使用给定数组中的值填充的新属性集。
protected HashAttributeSet(Attribute[] attributes, Class<?> interfaceName)
          构造一个新的属性集,其中该属性集的成员限于给定的接口。
protected HashAttributeSet(Attribute attribute, Class<?> interfaceName)
          构造一个最初使用给定属性填充的新属性集,其中该属性集的成员限于给定的接口。
  HashAttributeSet(AttributeSet attributes)
          构造一个最初使用给定集合中的值填充的新属性集。
protected HashAttributeSet(AttributeSet attributes, Class<?> interfaceName)
          构造一个最初使用给定集合中的值填充的新属性集,其中该属性集的成员限于给定的接口。
protected HashAttributeSet(Class<?> interfaceName)
          构造一个新的空属性集,其中该属性集的成员限于给定的接口。
 
方法摘要
 boolean add(Attribute attribute)
          如果指定的属性不存在,则将它添加到此属性集中,方法是首先移除与指定属性值相同的属性类别中的任何现有属性。
 boolean addAll(AttributeSet attributes)
          将指定集合中的所有元素添加到此属性中。
 void clear()
          从此属性集中移除所有属性。
 boolean containsKey(Class<?> category)
          如果此属性集包含指定类别的属性,则返回 true
 boolean containsValue(Attribute attribute)
          如果此属性集包含给定的属性,则返回 true
 boolean equals(Object object)
          比较指定的对象与此属性集的相等性。
 Attribute get(Class<?> category)
          返回此属性集在给定的属性类别中包含的属性值。
 int hashCode()
          返回此属性集的哈希码值。
 boolean isEmpty()
          如果此属性集不包含任何属性,则返回 true。
 boolean remove(Attribute attribute)
          从此属性集移除指定的属性(如果存在)。
 boolean remove(Class<?> category)
          从此属性集移除此类别的任何属性(如果存在)。
 int size()
          返回此属性集中属性的数量。
 Attribute[] toArray()
          返回此集合中包含的属性的数组。
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

HashAttributeSet

public HashAttributeSet()
构造一个新的、空属性集。


HashAttributeSet

public HashAttributeSet(Attribute attribute)
构造一个最初使用给定属性填充的新属性集。

参数:
attribute - 要添加到此集合的属性值。
抛出:
NullPointerException - (未经检查的异常)如果 attribute 为 null,则抛出该异常。

HashAttributeSet

public HashAttributeSet(Attribute[] attributes)
构造一个最初使用给定数组中的值填充的新属性集。通过将 attributes 数组中的元素从索引 0 开始按顺序添加到该集合来填充新的属性集。因此,如果该数组包含重复的属性值或属性类别,则后面的数组元素可以替换前面的数组元素。

参数:
attributes - 要添加到该集合的属性值的数组。如果为 null,则构造一个空属性集。
抛出:
NullPointerException - (未经检查的异常)如果 attributes 的任何元素为 null,则抛出该异常。

HashAttributeSet

public HashAttributeSet(AttributeSet attributes)
构造一个最初使用给定集合中的值填充的新属性集。

参数:
attributes - 从中初始化此集合的属性集。如果为 null,则构造一个空属性集。

HashAttributeSet

protected HashAttributeSet(Class<?> interfaceName)
构造一个新的空属性集,其中该属性集的成员限于给定的接口。

参数:
interfaceName - 此属性集的所有成员必须是其实例的接口。假设是接口 Attribute 或其子接口。
抛出:
NullPointerException - 如果 interfaceName 为 null。

HashAttributeSet

protected HashAttributeSet(Attribute attribute,
                           Class<?> interfaceName)
构造一个最初使用给定属性填充的新属性集,其中该属性集的成员限于给定的接口。

参数:
attribute - 要添加到此集合的属性值。
interfaceName - 此属性集的所有成员必须是其实例的接口。假设是接口 Attribute 或其子接口。
抛出:
NullPointerException - (未经检查的异常)如果 attribute 为 null,则抛出该异常。
NullPointerException - 如果 interfaceName 为 null。
ClassCastException - (未经检查的异常)如果 attribute 不是 interfaceName 的一个实例,则抛出该异常。

HashAttributeSet

protected HashAttributeSet(Attribute[] attributes,
                           Class<?> interfaceName)
构造一个新的属性集,其中该属性集的成员限于给定的接口。通过将 attributes 数组中的元素从索引 0 开始按顺序添加到该集合来填充新的属性集。因此,如果该数组包含重复的属性值或属性类别,则后面的数组元素可以替换前面的数组元素。

参数:
attributes - 要添加到该集合的属性值的数组。如果为 null,则构造一个空属性集。
interfaceName - 此属性集的所有成员必须是其实例的接口。假设是接口 Attribute 或其子接口。
抛出:
NullPointerException - (未经检查的异常)如果 attributes 的任何元素为 null,则抛出该异常。
NullPointerException - 如果 interfaceName 为 null。
ClassCastException - (未经检查的异常)如果 attributes 的元素不是 interfaceName 的一个实例,则抛出该异常。

HashAttributeSet

protected HashAttributeSet(AttributeSet attributes,
                           Class<?> interfaceName)
构造一个最初使用给定集合中的值填充的新属性集,其中该属性集的成员限于给定的接口。

参数:
attributes - 要初始化该集合的属性值的集合。如果为 null,则构造一个空属性集。
interfaceName - 此属性集的所有成员必须是其实例的接口。假设是接口 Attribute 或其子接口。
抛出:
ClassCastException - (未经检查的异常)如果 attributes 的元素不是 interfaceName 的一个实例,则抛出该异常。
方法详细信息

get

public Attribute get(Class<?> category)
返回此属性集在给定的属性类别中包含的属性值。如果此属性集在给定的属性类别中不包含任何属性值,则返回 null

指定者:
接口 AttributeSet 中的 get
参数:
category - 将返回其关联的属性值的属性类别。它必须是实现接口 AttributeClass
返回:
此属性集中包含的给定属性类别中的属性值,如果此属性集在给定的属性类别中不包含任何属性值,则返回 null
抛出:
NullPointerException - (未经检查的异常)如果 category 为 null,则抛出该异常。
ClassCastException - (未经检查的异常)如果 category 不是实现接口 AttributeClass,则抛出该异常。

add

public boolean add(Attribute attribute)
如果指定的属性不存在,则将它添加到此属性集中,方法是首先移除与指定属性值相同的属性类别中的任何现有属性。

指定者:
接口 AttributeSet 中的 add
参数:
attribute - 要添加到此属性集的属性值。
返回:
如果此属性集由于调用而发生改变(即:给定的属性值还不是此属性集的成员),则返回 true
抛出:
NullPointerException - (未经检查的异常)如果 attribute 为 null,则抛出该异常。
UnmodifiableSetException - (未经检查的异常)如果此属性集不支持 add() 操作,则抛出该异常。

remove

public boolean remove(Class<?> category)
从此属性集移除此类别的任何属性(如果存在)。如果 category 为 null,则 remove() 不执行任何操作,并返回 false

指定者:
接口 AttributeSet 中的 remove
参数:
category - 要从此属性集移除的属性类别。
返回:
如果此属性集由于调用而发生改变(即给定的属性类别已经成为此属性集的成员),则返回 true
抛出:
UnmodifiableSetException - (未经检查的异常)如果此属性集不支持 remove() 操作,则抛出该异常。

remove

public boolean remove(Attribute attribute)
从此属性集移除指定的属性(如果存在)。如果 attribute 为 null,则 remove() 不执行任何操作,并返回 false

指定者:
接口 AttributeSet 中的 remove
参数:
attribute - 从此属性集移除的属性值。
返回:
如果此属性集由于调用而发生改变(即:给定的属性值已经成为此属性集的成员),则返回 true
抛出:
UnmodifiableSetException - (未经检查的异常)如果此属性集不支持 remove() 操作,则抛出该异常。

containsKey

public boolean containsKey(Class<?> category)
如果此属性集包含指定类别的属性,则返回 true

指定者:
接口 AttributeSet 中的 containsKey
参数:
category - 将测试其是否存在于此属性集中的类别。
返回:
如果此属性集包含指定类别的一个属性值,则返回 true

containsValue

public boolean containsValue(Attribute attribute)
如果此属性集包含给定的属性,则返回 true

指定者:
接口 AttributeSet 中的 containsValue
参数:
attribute - 将测试其是否存在于此属性集中的值。
返回:
如果此属性集包含给定的属性值,则返回 true

addAll

public boolean addAll(AttributeSet attributes)
将指定集合中的所有元素添加到此属性中。该结果与使用指定集合中的每个元素将 add(Attribute) 操作成功地应用到此属性集中相同。如果正在进行此操作的同时修改了指定的集合,则 addAll(AttributeSet) 操作的行为是不确定的。

如果 addAll(AttributeSet) 操作抛出一个异常,则对此属性集状态的影响取决于实现方法;在异常点之前,不一定将指定集合中的元素添加到了此属性集。

指定者:
接口 AttributeSet 中的 addAll
参数:
attributes - 要将其元素添加到此属性集中的属性。
返回:
如果此属性集由于调用而发生改变,则返回 true
抛出:
UnmodifiableSetException - (未经检查的异常)如果此属性集不支持 addAll(AttributeSet) 方法,则抛出该异常。
NullPointerException - (未经检查的异常)如果指定集合中的某一元素为 null,或该集合为 null,则抛出该异常。
另请参见:
add(Attribute)

size

public int size()
返回此属性集中属性的数量。如果此属性集包含的元素多于 Integer.MAX_VALUE ,则返回 Integer.MAX_VALUE

指定者:
接口 AttributeSet 中的 size
返回:
此属性集中属性的数量。

toArray

public Attribute[] toArray()
从接口 AttributeSet 复制的描述
返回此集合中包含的属性的数组。

指定者:
接口 AttributeSet 中的 toArray
返回:
作为数组包含在此集合中的属性,如果 AttributeSet 为空,则返回零长度。

clear

public void clear()
从此属性集中移除所有属性。

指定者:
接口 AttributeSet 中的 clear
抛出:
UnmodifiableSetException - (未经检查的异常)如果此属性集不支持 clear() 操作,则抛出该异常。

isEmpty

public boolean isEmpty()
如果此属性集不包含任何属性,则返回 true。

指定者:
接口 AttributeSet 中的 isEmpty
返回:
如果此属性集不包含任何属性,则返回 true。

equals

public boolean equals(Object object)
比较指定的对象与此属性集的相等性。如果给定的对象也是一个属性集,并且两个属性集包含相同的属性类别到属性值的映射关系,则返回 true。这确保了 equals() 方法能跨越 AttributeSet 接口的不同实现正常运行。

指定者:
接口 AttributeSet 中的 equals
覆盖:
Object 中的 equals
参数:
object - 要与此属性集进行相等性比较的对象。
返回:
如果指定对象等于此属性集,则返回 true
另请参见:
Object.hashCode(), Hashtable

hashCode

public int hashCode()
返回此属性集的哈希码值。属性集的哈希码被定义为 AttributeSet 中每个条目的哈希码的总和。这确保了 t1.equals(t2) 意味对于任何两个属性集 t1t2 而言,都存在 t1.hashCode()==t2.hashCode(),这是 Object.hashCode() 的通用协定所要求的。

指定者:
接口 AttributeSet 中的 hashCode
覆盖:
Object 中的 hashCode
返回:
此属性集的哈希码值。
另请参见:
Object.equals(java.lang.Object), Hashtable

JavaTM 2 Platform
Standard Ed. 5.0

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

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