This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.management.modelmbean
class DescriptorSupport

java.lang.Object extended by javax.management.modelmbean.DescriptorSupport
All Implemented Interfaces:
Descriptor

Most common way to construct:

DescriptorSupport descr = new DescriptorSupport();

Based on 17 examples


public class DescriptorSupport
extends Object
implements Descriptor

This class represents the metadata set for a ModelMBean element. A descriptor is part of the ModelMBeanInfo, ModelMBeanNotificationInfo, ModelMBeanAttributeInfo, ModelMBeanConstructorInfo, and ModelMBeanParameterInfo.

A descriptor consists of a collection of fields. Each field is in fieldname=fieldvalue format. Field names are not case sensitive, case will be preserved on field values.

All field names and values are not predefined. New fields can be defined and added by any program. Some fields have been predefined for consistency of implementation and support by the ModelMBeanInfo, ModelMBeanAttributeInfo, ModelMBeanConstructorInfo, ModelMBeanNotificationInfo, ModelMBeanOperationInfo and ModelMBean classes.

The serialVersionUID of this class is -6292969195866300415L.


Constructor Summary

          Descriptor default constructor.

          Descriptor constructor taking a Descriptor as parameter.
DescriptorSupport(int initNumFields)

          Descriptor constructor.

          Descriptor constructor taking an XML String.

          Constructor taking fields in the fieldName=fieldValue format.
DescriptorSupport(String[] fieldNames, Object[] fieldValues)

          Constructor taking field names and field values.
 
Method Summary
 Object

          Returns a new Descriptor which is a duplicate of the Descriptor.
 boolean

          Compares this descriptor to the given object.
 String[]

          
 String[]

          
 Object
getFieldValue(String fieldName)

          
 Object[]
getFieldValues(String[] fieldNames)

          
 int

          Returns the hash code value for this descriptor.
 boolean

          Returns true if all of the fields have legal values given their names.
 void
removeField(String fieldName)

          
 void
setField(String fieldName, Object fieldValue)

          
 void
setFields(String[] fieldNames, Object[] fieldValues)

          
 String

          Returns a human readable string representing the descriptor.
 String

          Returns an XML String representing the descriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DescriptorSupport

public DescriptorSupport()
Descriptor default constructor. Default initial descriptor size is 20. It will grow as needed.
Note that the created empty descriptor is not a valid descriptor (the method {@link #isValid isValid} returns false)


DescriptorSupport

public DescriptorSupport(DescriptorSupport inDescr)
Descriptor constructor taking a Descriptor as parameter. Creates a new descriptor initialized to the values of the descriptor passed in parameter.

Parameters:
inDescr - the descriptor to be used to initialize the constructed descriptor. If it is null or contains no descriptor fields, an empty Descriptor will be created.

DescriptorSupport

public DescriptorSupport(int initNumFields)
                  throws MBeanException,
                         RuntimeOperationsException
Descriptor constructor. Takes as parameter the initial capacity of the Map that stores the descriptor fields. Capacity will grow as needed.
Note that the created empty descriptor is not a valid descriptor (the method {@link #isValid isValid} returns false).

Parameters:
initNumFields - The initial capacity of the Map that stores the descriptor fields.
Throws:
MBeanException - Wraps a distributed communication Exception.
RuntimeOperationsException - for illegal value for initNumFields (<= 0)

DescriptorSupport

public DescriptorSupport(String inStr)
                  throws MBeanException,
                         RuntimeOperationsException,
                         XMLParseException

Descriptor constructor taking an XML String.

The format of the XML string is not defined, but an implementation must ensure that the string returned by {@link #toXMLString() toXMLString()} on an existing descriptor can be used to instantiate an equivalent descriptor using this constructor.

In this implementation, all field values will be created as Strings. If the field values are not Strings, the programmer will have to reset or convert these fields correctly.

Parameters:
inStr - An XML-formatted string used to populate this Descriptor. The format is not defined, but any implementation must ensure that the string returned by method {@link #toXMLString toXMLString} on an existing descriptor can be used to instantiate an equivalent descriptor when instantiated using this constructor.
Throws:
MBeanException - Wraps a distributed communication Exception.
RuntimeOperationsException - If the String inStr passed in parameter is null
XMLParseException - XML parsing problem while parsing the input String

DescriptorSupport

public DescriptorSupport(String[] fields)
Constructor taking fields in the fieldName=fieldValue format.

Parameters:
fields - String array with each element containing a field name and value. If this array is null or empty, then the default constructor will be executed. Null strings or empty strings will be ignored.

All field values should be Strings. If the field values are not Strings, the programmer will have to reset or convert these fields correctly.

Note: Each string should be of the form fieldName=fieldValue. The field name ends at the first {@code =} character; for example if the String is {@code a=b=c} then the field name is {@code a} and its value is {@code b=c}.


DescriptorSupport

public DescriptorSupport(String[] fieldNames,
                         Object[] fieldValues)
                  throws RuntimeOperationsException
Constructor taking field names and field values. Neither array can be null.

Parameters:
fieldNames - String array of field names. No elements of this array can be null.
fieldValues - Object array of the corresponding field values. Elements of the array can be null. The fieldValue must be valid for the fieldName (as defined in method {@link #isValid isValid})

Note: array sizes of parameters should match. If both arrays are empty, then an empty descriptor is created.

Throws:
RuntimeOperationsException - for illegal value for field Names or field Values. The array lengths must be equal. If the descriptor construction fails for any reason, this exception will be thrown.
Method Detail

clone

public synchronized Object clone()
                          throws RuntimeOperationsException
Returns a new Descriptor which is a duplicate of the Descriptor.

Overrides:
clone in class Object
Throws:
RuntimeOperationsException - for illegal value for field Names or field Values. If the descriptor construction fails for any reason, this exception will be thrown.

equals

public synchronized boolean equals(Object o)
Compares this descriptor to the given object. The objects are equal if the given object is also a Descriptor, and if the two Descriptors have the same field names (possibly differing in case) and the same associated values. The respective values for a field in the two Descriptors are equal if the following conditions hold:

Overrides:
equals in class Object
Parameters:
o - the object to compare with.
Returns:
{@code true} if the objects are the same; {@code false} otherwise.

getFieldNames

public synchronized String[] getFieldNames()

getFields

public synchronized String[] getFields()

getFieldValue

public synchronized Object getFieldValue(String fieldName)
                                  throws RuntimeOperationsException
Parameters:
fieldName
Throws:
RuntimeOperationsException

getFieldValues

public synchronized Object[] getFieldValues(String[] fieldNames)
Parameters:
fieldNames

hashCode

public synchronized int hashCode()

Returns the hash code value for this descriptor. The hash code is computed as the sum of the hash codes for each field in the descriptor. The hash code of a field with name {@code n} and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}. Here {@code h} is the hash code of {@code v}, computed as follows:

Overrides:
hashCode in class Object
Returns:
A hash code value for this object.

isValid

public synchronized boolean isValid()
                             throws RuntimeOperationsException
Returns true if all of the fields have legal values given their names.

This implementation does not support interoperating with a directory or lookup service. Thus, conforming to the specification, no checking is done on the "export" field.

Otherwise this implementation returns false if:

Throws:
RuntimeOperationsException - If the validity checking fails for any reason, this exception will be thrown.

removeField

public synchronized void removeField(String fieldName)
Parameters:
fieldName

setField

public synchronized void setField(String fieldName,
                                  Object fieldValue)
                           throws RuntimeOperationsException
Parameters:
fieldName
fieldValue
Throws:
RuntimeOperationsException

setFields

public synchronized void setFields(String[] fieldNames,
                                   Object[] fieldValues)
                            throws RuntimeOperationsException
Parameters:
fieldNames
fieldValues
Throws:
RuntimeOperationsException

toString

public synchronized String toString()
Returns a human readable string representing the descriptor. The string will be in the format of "fieldName=fieldValue,fieldName2=fieldValue2,..."
If there are no fields in the descriptor, then an empty String is returned.
If a fieldValue is an object then the toString() method is called on it and its returned value is used as the value for the field enclosed in parenthesis.

Overrides:
toString in class Object

toXMLString

public synchronized String toXMLString()

Returns an XML String representing the descriptor.

The format is not defined, but an implementation must ensure that the string returned by this method can be used to build an equivalent descriptor when instantiated using the constructor {@link #DescriptorSupport(String) DescriptorSupport(String inStr)}.

Fields which are not String objects will have toString() called on them to create the value. The value will be enclosed in parentheses. It is not guaranteed that you can reconstruct these objects unless they have been specifically set up to support toString() in a meaningful format and have a matching constructor that accepts a String in the same format.

If the descriptor is empty the following String is returned: <Descriptor></Descriptor>

Returns:
the XML string.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.