java.lang.Object
javax.management.MBeanFeatureInfo
javax.management.MBeanAttributeInfo
javax.management.modelmbean.ModelMBeanAttributeInfo
- 所有已实现的接口:
Serializable
,Cloneable
,DescriptorAccess
,DescriptorRead
ModelMBeanAttributeInfo 对象描述了 ModelMBean 的一个属性。它是 MBeanAttributeInfo 的子类,添加了关联的 Descriptor 和 DescriptorAccess 接口的实现。
描述符中的字段定义如下,但不限于以下内容。请注意,当此表中的 Type 为 Number 时,也可以使用作为 Long 的十进制表示形式的 String。
Name | Type | 意义 |
---|---|---|
name | String | 属性名称。 |
描述符类型 | String | 必须是“属性”。 |
value | Object | 属性的当前(缓存)值。 |
default | Object | 属性的默认值。 |
显示名称 | String | 要在显示中使用的属性名称。 |
getMethod | String | get 方法的操作描述符的名称。 |
设置方法 | String | set 方法的操作描述符的名称。 |
协议映射 | Descriptor | 请参阅 JMX 规范文档中的“协议映射支持”部分。映射必须适用于属性,并且可以在运行时更新或扩充条目。 |
坚持策略 | String | 其中之一:OnUpdate|OnTimer|NoMoreOftenThan|OnUnregister|Always|Never。请参阅 JMX 规范文档中的“MBean 描述符字段”部分。 |
持续期 | Number | 持续周期的频率(以秒为单位)。当 persistPolicy 为“OnTimer”或“NoMoreOftenThan”时使用。 |
货币时间限制 | Number | value 的有效期:<0 从不,=0 始终,>0 秒。 |
最后更新时间戳 | Number | 当 value 被设置时。 |
能见度 | Number | 1-4 其中 1:始终可见,4:很少可见。 |
演示字符串 | String | XML 格式的字符串以允许显示数据。 |
默认描述符包含名称、描述符类型和显示名称字段。 name 和 displayName 字段的默认值是属性的名称。
笔记:由于本规范以前版本的不一致,建议不要对 currencyTimeLimit
使用负值或零值。要指示缓存值永远无效,请省略 currencyTimeLimit
字段。要指示它始终有效,请为此字段使用一个非常大的数字。
这serialVersionUID这个类的是6181543027787327345L
。
- 自从:
- 1.5
- 参见:
-
字段摘要
在类 javax.management.MBeanFeatureInfo 中声明的字段
description, name
-
构造方法总结
构造方法构造方法描述ModelMBeanAttributeInfo
(String name, String description, Method getter, Method setter) 使用默认描述符构造一个 ModelMBeanAttributeInfo 对象。ModelMBeanAttributeInfo
(String name, String description, Method getter, Method setter, Descriptor descriptor) 构造一个 ModelMBeanAttributeInfo 对象。ModelMBeanAttributeInfo
(String name, String type, String description, boolean isReadable, boolean isWritable, boolean isIs) 使用默认描述符构造一个 ModelMBeanAttributeInfo 对象。ModelMBeanAttributeInfo
(String name, String type, String description, boolean isReadable, boolean isWritable, boolean isIs, Descriptor descriptor) 构造一个 ModelMBeanAttributeInfo 对象。从此 ModelMBeanAttributeInfo 对象构造一个新的 ModelMBeanAttributeInfo 对象。 -
方法总结
修饰符和类型方法描述clone()
创建并返回一个新的 ModelMBeanAttributeInfo,它是此 ModelMBeanAttributeInfo 的副本。获取 ModelMBeanAttributeInfo 的关联 Descriptor 的副本。void
setDescriptor
(Descriptor inDescriptor) 为 ModelMBeanAttributeDescriptor 设置关联的描述符(完全替换)。toString()
返回 ModelMBeanAttributeInfo 实例的人类可读版本。在类 javax.management.MBeanAttributeInfo 中声明的方法
equals, getType, isIs, isReadable, isWritable
在类 javax.management.MBeanFeatureInfo 中声明的方法
getDescription, getName
-
构造方法详细信息
-
ModelMBeanAttributeInfo
public ModelMBeanAttributeInfo(String name, String description, Method getter, Method setter) throws IntrospectionException 使用默认描述符构造一个 ModelMBeanAttributeInfo 对象。构造对象的Descriptor
将包括由包含DescriptorKey
元注释的Method
对象上的任何注释提供的字段。- 参数:
name
- 属性的名称。description
- 人类可读的属性描述。选修的。getter
- 用于读取属性值的方法。如果属性是只写的,则可能为 null。setter
- 用于写入属性值的方法。如果属性是只读的,则可能为 null。- 抛出:
IntrospectionException
- 此属性的定义存在一致性问题。
-
ModelMBeanAttributeInfo
public ModelMBeanAttributeInfo(String name, String description, Method getter, Method setter, Descriptor descriptor) throws IntrospectionException - 参数:
name
- 属性的名称。description
- 人类可读的属性描述。选修的。getter
- 用于读取属性值的方法。如果属性是只写的,则可能为 null。setter
- 用于写入属性值的方法。如果属性是只读的,则可能为 null。descriptor
- 一个描述符实例,包含此属性实例的适当元数据。如果为空,则将创建默认描述符。如果描述符不包含字段“displayName”,则此字段将添加到具有默认值的描述符中。- 抛出:
IntrospectionException
- 此属性的定义存在一致性问题。RuntimeOperationsException
- 包装 IllegalArgumentException。描述符无效,或者描述符字段“名称”不等于名称参数,或者描述符字段“descriptorType”不等于“属性”。
-
ModelMBeanAttributeInfo
public ModelMBeanAttributeInfo(String name, String type, String description, boolean isReadable, boolean isWritable, boolean isIs) 使用默认描述符构造一个 ModelMBeanAttributeInfo 对象。- 参数:
name
- 属性的名称type
- 属性的类型或类名description
- 人类可读的属性描述。isReadable
- 如果属性有 getter 方法则为真,否则为假。isWritable
- 如果属性具有 setter 方法,则为 True,否则为 false。isIs
- 如果属性具有“is”吸气剂,则为真,否则为假。
-
ModelMBeanAttributeInfo
public ModelMBeanAttributeInfo(String name, String type, String description, boolean isReadable, boolean isWritable, boolean isIs, Descriptor descriptor) 构造一个 ModelMBeanAttributeInfo 对象。- 参数:
name
- 属性的名称type
- 属性的类型或类名description
- 人类可读的属性描述。isReadable
- 如果属性有 getter 方法则为真,否则为假。isWritable
- 如果属性具有 setter 方法,则为 True,否则为 false。isIs
- 如果属性具有“is”吸气剂,则为真,否则为假。descriptor
- 一个描述符实例,包含此属性实例的适当元数据。如果它为 null,则将创建一个默认描述符。如果描述符不包含字段“displayName”,则此字段将添加到具有默认值的描述符中。- 抛出:
RuntimeOperationsException
- 包装 IllegalArgumentException。描述符无效,或者描述符字段“名称”不等于名称参数,或者描述符字段“descriptorType”不等于“属性”。
-
ModelMBeanAttributeInfo
从此 ModelMBeanAttributeInfo 对象构造一个新的 ModelMBeanAttributeInfo 对象。将创建默认描述符。- 参数:
inInfo
- 要复制的 ModelMBeanAttributeInfo
-
-
方法详情
-
getDescriptor
获取 ModelMBeanAttributeInfo 的关联 Descriptor 的副本。- 指定者:
getDescriptor
在接口DescriptorRead
中- 重写:
getDescriptor
在类MBeanFeatureInfo
中- 返回:
- 与 ModelMBeanAttributeInfo 对象关联的描述符。
- 参见:
-
setDescriptor
为 ModelMBeanAttributeDescriptor 设置关联的描述符(完全替换)。如果新的 Descriptor 为空,则关联的 Descriptor 恢复为默认描述符。描述符在分配之前经过验证。如果新的 Descriptor 无效,则抛出包含 IllegalArgumentException 的 RuntimeOperationsException。- 指定者:
setDescriptor
在接口DescriptorAccess
中- 参数:
inDescriptor
- 替换与 ModelMBeanAttributeInfo 关联的描述符- 抛出:
RuntimeOperationsException
- 包装无效描述符的 IllegalArgumentException- 参见:
-
clone
创建并返回一个新的 ModelMBeanAttributeInfo,它是此 ModelMBeanAttributeInfo 的副本。- 重写:
clone
在类MBeanAttributeInfo
中- 返回:
- 此实例的克隆。
- 抛出:
RuntimeOperationsException
- 字段名称或字段值的非法值。如果描述符构造因任何原因失败,将抛出此异常。- 参见:
-
toString
返回 ModelMBeanAttributeInfo 实例的人类可读版本。
-