javax.management.modelmbean
Class DescriptorSupport

java.lang.Object
  extended byjavax.management.modelmbean.DescriptorSupport
All Implemented Interfaces:
java.lang.Cloneable, Descriptor, java.io.Serializable

public class DescriptorSupport
extends java.lang.Object
implements Descriptor

Version:
$Revision: 1.4 $
Author:
Simone Bordet
See Also:
Serialized Form

Constructor Summary
DescriptorSupport()
           
DescriptorSupport(java.lang.String[] pairs)
           
DescriptorSupport(java.lang.String[] names, java.lang.Object[] values)
           
 
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 name)
          Returns the field value of a given field name.
 java.lang.Object[] getFieldValues(java.lang.String[] names)
          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 name)
          Remove a field using the given field name.
 void setField(java.lang.String name, java.lang.Object value)
          Sets a field name and field value.
 void setFields(java.lang.String[] names, java.lang.Object[] values)
          Sets the given fieldNames against the givent fieldValues.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DescriptorSupport

public DescriptorSupport()

DescriptorSupport

public DescriptorSupport(java.lang.String[] pairs)

DescriptorSupport

public DescriptorSupport(java.lang.String[] names,
                         java.lang.Object[] values)
Method Detail

clone

public java.lang.Object clone()
                       throws RuntimeOperationsException
Description copied from interface: Descriptor
Returns a new Descriptor of which is a duplicate of this Descriptor

Specified by:
clone in interface Descriptor
Throws:
RuntimeOperationsException

getFieldValue

public java.lang.Object getFieldValue(java.lang.String name)
                               throws RuntimeOperationsException
Description copied from interface: Descriptor
Returns the field value of a given field name.

Specified by:
getFieldValue in interface Descriptor
Parameters:
name - 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:
RuntimeOperationsException

setField

public void setField(java.lang.String name,
                     java.lang.Object value)
              throws RuntimeOperationsException
Description copied from interface: Descriptor
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.

Specified by:
setField in interface Descriptor
Parameters:
name - The name of the field to set againts
value - 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 name)
Description copied from interface: Descriptor
Remove a field using the given field name.

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

Specified by:
removeField in interface Descriptor
Parameters:
name - The field name to be removed.

getFieldNames

public java.lang.String[] getFieldNames()
Description copied from interface: Descriptor
Return all the field names as an array of String.

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

Specified by:
getFieldNames in interface Descriptor
Returns:
String[] The array of field names.

getFieldValues

public java.lang.Object[] getFieldValues(java.lang.String[] names)
Description copied from interface: Descriptor
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.

Specified by:
getFieldValues in interface Descriptor
Parameters:
names - The array of fieldnames
Returns:
Object[] The array of all field values corresponding to the given fieldNames array.

getFields

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

Specified by:
getFields in interface Descriptor
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[] names,
                      java.lang.Object[] values)
               throws RuntimeOperationsException
Description copied from interface: Descriptor
Sets the given fieldNames against the givent fieldValues. The size of both given array should match.

Specified by:
setFields in interface Descriptor
Throws:
RuntimeOperationsException - if fieldNames or fieldValues contains illegal values.

isValid

public boolean isValid()
                throws RuntimeOperationsException
Description copied from interface: Descriptor
Returns true if fieldValues are checked to be sure they are legal for the fieldNames.

Specified by:
isValid in interface Descriptor
Throws:
RuntimeOperationsException - If the validity checking fails.


Copyright © 2001-2002 MX4J Team. All Rights Reserved.