站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 jmx API Documentation 英文版文档

Descriptor (JBoss/JMX API) - JBoss 4.0.1 sp1 jmx API Documentation 英文版文档


javax.management
Interface Descriptor

All Superinterfaces:
Cloneable, Serializable
All Known Implementing Classes:
DescriptorSupport

public interface Descriptor
extends Serializable, Cloneable

This interface defines behavioral and runtime metadata for ModelMBeans. A descriptor is a set of name-value pairs.

The DescriptorAccess interface defines how to get and set Descriptors for a ModelMBean's metadata classes.

The implementation must implement the following constructors.

Descriptor() returns an empty descriptor.

Descriptor(Descriptor) returns a copy of the decriptor.

Descriptor(String[], Object[]) a constructor that verifies the field names include a descriptorType and that predefined fields contain valid values.

Version:
$Revision: 1.5 $
Author:
Adrian Brock.
See Also:
DescriptorAccess, ModelMBean

Method Summary
 Object clone()
          Returns a descriptor that is a duplicate of this one.
 String[] getFieldNames()
          Retrieves all the field names in this descriptor.
 String[] getFields()
          Retrieves all the fields in this descriptor.
 Object getFieldValue(String fieldName)
          Retrieves the value of a field.
 Object[] getFieldValues(String[] fieldNames)
          Retrieves all the field values for the passed field names.
 boolean isValid()
          Checks to see that this descriptor is valid.
 void removeField(String fieldName)
          Remove a field from the descriptor.
 void setField(String fieldName, Object fieldValue)
          Sets the value of a field.
 void setFields(String[] fieldNames, Object[] fieldValues)
          Set multiple fields in this descriptor.
 

Method Detail

getFieldValue

public Object getFieldValue(String fieldName)
                     throws RuntimeOperationsException
Retrieves the value of a field.

Parameters:
fieldName - the name of the field.
Returns:
the value of the field.
Throws:
RuntimeOperationsException - when the field name is not valid.

setField

public void setField(String fieldName,
                     Object fieldValue)
              throws RuntimeOperationsException
Sets the value of a field.

Parameters:
fieldName - the name of the field.
fieldValue - the value of the field.
Throws:
RuntimeOperationsException - when the field name or value is not valid.

getFields

public String[] getFields()
Retrieves all the fields in this descriptor. The format is fieldName=fieldValue for String values and fieldName=(fieldValue.toString()) for other value types.

Returns:
an array of fieldName=fieldValue strings.

getFieldNames

public String[] getFieldNames()
Retrieves all the field names in this descriptor.

Returns:
an array of field name strings.

getFieldValues

public Object[] getFieldValues(String[] fieldNames)
Retrieves all the field values for the passed field names. The array of object values returned is in the same order as the field names passed to the method.

When a fieldName does not exist, the corresponding element of the returned array is null.

Parameters:
fieldNames - the array of field names to retrieve. Pass null to retrieve all fields.
Returns:
an array of field values.

removeField

public void removeField(String fieldName)
Remove a field from the descriptor.

Parameters:
fieldName - the field to remove. No exception is thrown when the field is not in the descriptor.

setFields

public void setFields(String[] fieldNames,
                      Object[] fieldValues)
               throws RuntimeOperationsException
Set multiple fields in this descriptor. The field in the fieldNames array is set to the value of the corresponding fieldValues array. The two arrays must be the same size.

Parameters:
fieldNames - an array of fieldNames to set. Neither the array or array elements can be null. The fieldName must exist.
fieldValues - an array of fieldValues to set. Neither the array or array elements can be null. The fieldValue must be valid for the corresponding fieldName.
Throws:
RuntimeOperationsException - for not existent or fieldNames, invalid or null fieldValues, the two arrays are different sizes or the contructor fails for any reason.

clone

public Object clone()
             throws RuntimeOperationsException
Returns a descriptor that is a duplicate of this one.

Throws:
RuntimeOperationsException - for invalid fieldNames, fieldValues or the contructor fails for any reason.

isValid

public boolean isValid()
                throws RuntimeOperationsException
Checks to see that this descriptor is valid.

Returns:
true when the fieldValues are legal for the fieldNames, false otherwise.
Throws:
RuntimeOperationsException - for any error performing the validation.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.