javax.management
Interface Descriptor

All Superinterfaces:
java.lang.Cloneable, java.io.Serializable
All Known Implementing Classes:
DescriptorSupport

public interface Descriptor
extends java.lang.Cloneable, java.io.Serializable

Descriptor is cloneable since represent a snapshot of what the client passed in to the model mbean. This ensures that if the client nulls out some value, the descriptor is still valid, since it has been cloned prior the client modification. The client can always re-set the descriptor on the model mbean.


Method Summary
 java.lang.Object clone()
          Returns a new Descriptor of which is a duplicate of this Descriptor
 java.lang.String[] getFieldNames()
          Return all the field names as an array of String.
 java.lang.String[] getFields()
          Returns all the fields contained in this Descriptor as an array.
 java.lang.Object getFieldValue(java.lang.String fieldName)
          Returns the field value of a given field name.
 java.lang.Object[] getFieldValues(java.lang.String[] fieldNames)
          Return all field values as an array using the given field names array.
 boolean isValid()
          Returns true if fieldValues are checked to be sure they are legal for the fieldNames.
 void removeField(java.lang.String fieldName)
          Remove a field using the given field name.
 void setField(java.lang.String fieldName, java.lang.Object fieldValue)
          Sets a field name and field value.
 void setFields(java.lang.String[] fieldNames, java.lang.Object[] fieldValues)
          Sets the given fieldNames against the givent fieldValues.
 

Method Detail

getFieldValue

public java.lang.Object getFieldValue(java.lang.String fieldName)
                               throws RuntimeOperationsException
Returns the field value of a given field name.

Parameters:
fieldName - The field name where the value being retrieved is for.
Returns:
Object The value for the given field name. Returns null if not found.
Throws:
RuntimeOperationException - if the value for field name is illegal
RuntimeOperationsException

setField

public void setField(java.lang.String fieldName,
                     java.lang.Object fieldValue)
              throws RuntimeOperationsException
Sets a field name and field value. The field value will be checked before being set. This will either add a new field or update it if it already exists.

Parameters:
fieldName - The name of the field to set againts
fieldValue - The value for the given field name being set
Throws:
RuntimeOperationsException - If values for fieldName or fieldValue are illegal or the description construction fails, then this exception will be thrown

removeField

public void removeField(java.lang.String fieldName)
Remove a field using the given field name.

Note that this method will be silent if no such field is found.

Parameters:
fieldName - The field name to be removed.

getFieldNames

public java.lang.String[] getFieldNames()
Return all the field names as an array of String.

Note that this method will return an empty array if the Descriptor is empty.

Returns:
String[] The array of field names.

getFieldValues

public java.lang.Object[] getFieldValues(java.lang.String[] fieldNames)
Return all field values as an array using the given field names array.

Note that the order of the returned Object[] is the same as the order of the field name argument.

Parameters:
fieldNames - The array of fieldnames
Returns:
Object[] The array of all field values corresponding to the given fieldNames array.

getFields

public java.lang.String[] getFields()
Returns all the fields contained in this Descriptor as an array.

Returns:
String[] The String array in the format fieldName=fieldValue.An empty descriptor will result with an empty array.

setFields

public void setFields(java.lang.String[] fieldNames,
                      java.lang.Object[] fieldValues)
               throws RuntimeOperationsException
Sets the given fieldNames against the givent fieldValues. The size of both given array should match.

Throws:
RuntimeOperationsException - if fieldNames or fieldValues contains illegal values.

clone

public java.lang.Object clone()
                       throws RuntimeOperationsException
Returns a new Descriptor of which is a duplicate of this Descriptor

Returns:
Object The cloned Descriptor
RuntimeOperationsException

isValid

public boolean isValid()
                throws RuntimeOperationsException
Returns true if fieldValues are checked to be sure they are legal for the fieldNames.

Throws:
RuntimeOperationsException - If the validity checking fails.