所有类


javax.management.openmbean
类 CompositeDataSupport

java.lang.Object
  继承者 javax.management.openmbean.CompositeDataSupport
所有已实现的接口:
Serializable, CompositeData

public class CompositeDataSupport
   
   
   
   
   
extends Object
implements CompositeData, Serializable

CompositeDataSupport 类是实现 CompositeData 接口的开放数据 类。

从以下版本开始:
1.5
另请参见:
序列化表格

构造方法摘要
CompositeDataSupport(CompositeType compositeType, Map items)
           使用指定的 compositeType(其项名称和对应值由 items 映射中的映射关系给出)构造一个 CompositeDataSupport 实例。
CompositeDataSupport(CompositeType compositeType, String[] itemNames, Object[] itemValues)
           使用指定的 compositeType(其项值由 itemValues[] 按照与 itemNames[] 中相同的顺序指定)构造一个 CompositeDataSupport 实例。
 
方法摘要
 booleancontainsKey(String key)
          当且仅当此 CompositeData 实例包含名称是 key 的项时,才返回 true
 booleancontainsValue(Object value)
          当且仅当此 CompositeData 实例包含其值是 value 的项时,返回 true
 booleanequals(Object obj)
          比较指定的 obj 参数与此 CompositeDataSupport 实例的相等性。
 Objectget(String key)
          返回其名称是 key 的项的值。
 Object[]getAll(String[] keys)
          返回由 keys 指定其项名称的值的数组,顺序与 keys 相同。
 CompositeTypegetCompositeType()
          返回此复合数据 实例的复合类型
 inthashCode()
          返回此 CompositeDataSupport 实例的哈希码值。
 StringtoString()
          返回此 CompositeDataSupport 实例的字符串表示形式。
 Collectionvalues()
          返回此 CompositeData 实例中包含的项值的不可修改的 Collection 视图。
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

CompositeDataSupport

public CompositeDataSupport(CompositeType compositeType,
                            String[] itemNames,
                            Object[] itemValues)
                     throws OpenDataException

使用指定的 compositeType(其项值由 itemValues[] 按照与 itemNames[] 中相同的顺序指定)构造一个 CompositeDataSupport 实例。由于 CompositeType 未对其项指定任何顺序,所以使用 itemNames[] 参数指定在 itemValues[] 中给出的值的顺序。此 CompositeDataSupport 实例中包含的项内部存储在 TreeMap 中,并且按它们名称的升序字典顺序进行存储,以便于对各个项值进行较快速的检索。

构造方法检查是否满足下面为每个参数列出的所有约束条件,如果无法满足,则抛出适当的异常。

参数:
compositeType - 此复合数据 实例的复合类型;不能为 null。

itemNames - itemNames 必须以任一顺序列出在 compositeType 中定义的所有项名称;使用列出名称的顺序来匹配 itemValues[] 中的值;不能为 null 或空。

itemValues - 按与 itemNames 中它们各自名称相同的顺序列出的项的值;每个项值可以为 null,但是,如果为非 null,则它必须是在 compositeType 中为对应的项定义的开放类型的有效值;大小必须与 itemNames 相同;不能为 null 或空。

抛出:
IllegalArgumentException - compositeType 为 null,或者 itemNames[]itemValues[] 为 null 或空,或者 itemNames[] 中的元素之一为 null 或空字符串,或者 itemNames[]itemValues[] 的大小不相同。

OpenDataException - itemNames[]itemValues[] 的大小与 compositeType 中定义的项数不同,或者 itemNames[] 中的元素之一不作为在 compositeType 中定义的项名称存在,或者 itemValues[] 中的元素之一不是 compositeType 中定义的相应项的有效值。


CompositeDataSupport

public CompositeDataSupport(CompositeType compositeType,
                            Map items)
                     throws OpenDataException

使用指定的 compositeType(其项名称和对应值由 items 映射中的映射关系给出)构造一个 CompositeDataSupport 实例。此构造方法将键转换为一个字符串数组,将值转换为一个对象数组,并调用 CompositeDataSupport(javax.management.openmbean.CompositeType, java.lang.String[], java.lang.Object[])

参数:
compositeType - 此复合数据 实例的复合类型;不能为 null。

items - 所有项名称到它们的值的映射;items 必须包含 compositeType 中定义的所有项名称;不能为 null 或空。

抛出:
IllegalArgumentException - compositeType 为 null,或者 items 为 null 或空,或者 items 中的键之一为 null 或空字符串,或者 items 中的值之一为 null。

OpenDataException - items 的大小与 compositeType 中定义的项数不同,或者 items 中的键之一不作为 compositeType 中定义的项名称存在,或者 items 中的值之一不是 compositeType 中定义的相应项的有效值。

ArrayStoreException - items 中的一个或多个键不是 java.lang.String 类。

方法详细信息

getCompositeType

public CompositeType getCompositeType()
返回此复合数据 实例的复合类型

指定者:
接口 CompositeData 中的 getCompositeType
返回:
此 CompositeData 的类型。

get

public Object get(String key)
返回其名称是 key 的项的值。

指定者:
接口 CompositeData 中的 get
参数:
key - 项的名称。
返回:
与此键关联的值。
抛出:
IllegalArgumentException - 如果 key 为 null 或空字符串。
InvalidKeyException - 如果 key 不是此 CompositeData 实例的现有项名称。

getAll

public Object[] getAll(String[] keys)
返回由 keys 指定其项名称的值的数组,顺序与 keys 相同。

指定者:
接口 CompositeData 中的 getAll
返回:
与键对应的值。
抛出:
IllegalArgumentException - 如果 keys 中的元素为 null 或空字符串。
InvalidKeyException - 如果 keys 中的元素不是此 CompositeData 实例的现有项名称。

containsKey

public boolean containsKey(String key)
当且仅当此 CompositeData 实例包含名称是 key 的项时,才返回 true。如果 key 为 null 或空字符串,则此方法只返回 false。

指定者:
接口 CompositeData 中的 containsKey
参数:
key - 要测试的键。
返回:
如果此 CompositeData 包含该键,则返回 true。

containsValue

public boolean containsValue(Object value)
当且仅当此 CompositeData 实例包含其值是 value 的项时,返回 true

指定者:
接口 CompositeData 中的 containsValue
参数:
value - 要测试的值。
返回:
如果此 CompositeData 包含该值,则返回 true。

values

public Collection values()
返回此 CompositeData 实例中包含的项值的不可修改的 Collection 视图。返回集合的迭代器将按相应项名称的升序字典顺序返回该值。

指定者:
接口 CompositeData 中的 values
返回:
值。