jdk/src/share/classes/javax/management/Descriptor.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 833 bfa2bef7517c
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Portions Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * @author    IBM Corp.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * Copyright IBM Corp. 1999-2000.  All rights reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
package javax.management;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
// Javadoc imports:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.lang.management.MemoryUsage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.util.Arrays;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.util.ResourceBundle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import javax.management.openmbean.CompositeData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import javax.management.openmbean.OpenMBeanAttributeInfoSupport;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import javax.management.openmbean.OpenMBeanOperationInfoSupport;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import javax.management.openmbean.OpenMBeanParameterInfoSupport;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import javax.management.openmbean.OpenType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <p>Additional metadata for a JMX element.  A {@code Descriptor}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * is associated with a {@link MBeanInfo}, {@link MBeanAttributeInfo}, etc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * It consists of a collection of fields.  A field is a name and an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * associated value.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <p>Field names are not case-sensitive.  The names {@code descriptorType},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * {@code descriptortype}, and {@code DESCRIPTORTYPE} are all equivalent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * However, the case that was used when the field was first set is preserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * in the result of the {@link #getFields} and {@link #getFieldNames}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * methods.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * <p>Not all field names and values are predefined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * New fields can be defined and added by any program.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * <p>A descriptor can be mutable or immutable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * An immutable descriptor, once created, never changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * The <code>Descriptor</code> methods that could modify the contents
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * of the descriptor will throw an exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * for an immutable descriptor.  Immutable descriptors are usually
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * instances of {@link ImmutableDescriptor} or a subclass.  Mutable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * descriptors are usually instances of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * {@link javax.management.modelmbean.DescriptorSupport} or a subclass.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * <p>Certain fields are used by the JMX implementation.  This means
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * either that the presence of the field may change the behavior of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * the JMX API or that the field may be set in descriptors returned by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * the JMX API.  These fields appear in <i>italics</i> in the table
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * below, and each one has a corresponding constant in the {@link JMX}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * class.  For example, the field {@code defaultValue} is represented
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * by the constant {@link JMX#DEFAULT_VALUE_FIELD}.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * <p>Certain other fields have conventional meanings described in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * table below but they are not required to be understood or set by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * the JMX implementation.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * <p>Field names defined by the JMX specification in this and all
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * future versions will never contain a period (.).  Users can safely
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * create their own fields by including a period in the name and be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * sure that these names will not collide with any future version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * the JMX API.  It is recommended to follow the Java package naming
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * convention to avoid collisions between field names from different
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * origins.  For example, a field created by {@code example.com} might
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * have the name {@code com.example.interestLevel}.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * <p>Note that the values in the {@code defaultValue}, {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * legalValues}, {@code maxValue}, and {@code minValue} fields should
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * be consistent with the type returned by the {@code getType()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * method for the associated {@code MBeanAttributeInfo} or {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * MBeanParameterInfo}.  For MXBeans, this means that they should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * of the mapped Java type, called <em>opendata</em>(J) in the <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * href="MXBean.html#mapping-rules">MXBean type mapping rules</a>.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * <table border="1" cellpadding="5">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * <tr><th>Name</th><th>Type</th><th>Used in</th><th>Meaning</th></tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * <tr><td><a name="defaultValue"><i>defaultValue</i></a><td>Object</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * <td>MBeanAttributeInfo<br>MBeanParameterInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 * <td>Default value for an attribute or parameter.  See
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * {@link javax.management.openmbean}.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * <tr><td>deprecated</td><td>String</td><td>Any</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * <td>An indication that this element of the information model is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * longer recommended for use.  A set of MBeans defined by an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * application is collectively called an <em>information model</em>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * The convention is for the value of this field to contain a string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * that is the version of the model in which the element was first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 * deprecated, followed by a space, followed by an explanation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * deprecation, for example {@code "1.3 Replaced by the Capacity
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * attribute"}.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 * <tr><td>descriptionResource<br>BundleBaseName</td><td>String</td><td>Any</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 * <td>The base name for the {@link ResourceBundle} in which the key given in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 * the {@code descriptionResourceKey} field can be found, for example
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * {@code "com.example.myapp.MBeanResources"}.  The meaning of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * field is defined by this specification but the field is not set or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 * used by the JMX API itself.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 * <tr><td>descriptionResourceKey</td><td>String</td><td>Any</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 * <td>A resource key for the description of this element.  In
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * conjunction with the {@code descriptionResourceBundleBaseName},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 * this can be used to find a localized version of the description.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * The meaning of this field is defined by this specification but the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 * field is not set or used by the JMX API itself.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 * <tr><td>enabled</td><td>String</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 * <td>MBeanAttributeInfo<br>MBeanNotificationInfo<br>MBeanOperationInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 * <td>The string {@code "true"} or {@code "false"} according as this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * item is enabled.  When an attribute or operation is not enabled, it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * exists but cannot currently be accessed.  A user interface might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 * present it as a greyed-out item.  For example, an attribute might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * only be meaningful after the {@code start()} method of an MBean has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * been called, and is otherwise disabled.  Likewise, a notification
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 * might be disabled if it cannot currently be emitted but could be in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * other circumstances.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 * <tr><td><a name="immutableInfo"><i>immutableInfo</i></a><td>String</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 * <td>MBeanInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 * <td>The string {@code "true"} or {@code "false"} according as this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 * MBean's MBeanInfo is <em>immutable</em>.  When this field is true,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 * the MBeanInfo for the given MBean is guaranteed not to change over
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 * the lifetime of the MBean.  Hence, a client can read it once and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 * cache the read value.  When this field is false or absent, there is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 * no such guarantee, although that does not mean that the MBeanInfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 * will necessarily change.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 * <tr><td>infoTimeout</td><td>String<br>Long</td><td>MBeanInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 * <td>The time in milli-seconds that the MBeanInfo can reasonably be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 * expected to be unchanged.  The value can be a {@code Long} or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 * decimal string.  This provides a hint from a DynamicMBean or any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 * MBean that does not define {@code immutableInfo} as {@code true}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 * that the MBeanInfo is not likely to change within this period and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 * therefore can be cached.  When this field is missing or has the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 * value zero, it is not recommended to cache the MBeanInfo unless it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 * has the {@code immutableInfo} set to {@code true}.</td></tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * <tr><td><a name="interfaceClassName"><i>interfaceClassName</i></a></td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 * <td>String</td><td>MBeanInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 * <td>The Java interface name for a Standard MBean or MXBean, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 * returned by {@link Class#getName()}.  A Standard MBean or MXBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 * registered directly in the MBean Server or created using the {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 * StandardMBean} class will have this field in its MBeanInfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 * Descriptor.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 * <tr><td><a name="legalValues"><i>legalValues</i></a></td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 * <td>{@literal Set<?>}</td><td>MBeanAttributeInfo<br>MBeanParameterInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 * <td>Legal values for an attribute or parameter.  See
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 * {@link javax.management.openmbean}.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 * <tr><td><a name="maxValue"><i>maxValue</i></a><td>Object</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 * <td>MBeanAttributeInfo<br>MBeanParameterInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 * <td>Maximum legal value for an attribute or parameter.  See
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 * {@link javax.management.openmbean}.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 * <tr><td><a name="metricType">metricType</a><td>String</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
 * <td>MBeanAttributeInfo<br>MBeanOperationInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 * <td>The type of a metric, one of the strings "counter" or "gauge".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
 * A metric is a measurement exported by an MBean, usually an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
 * attribute but sometimes the result of an operation.  A metric that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 * is a <em>counter</em> has a value that never decreases except by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 * being reset to a starting value.  Counter metrics are almost always
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 * non-negative integers.  An example might be the number of requests
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 * received.  A metric that is a <em>gauge</em> has a numeric value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * that can increase or decrease.  Examples might be the number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 * open connections or a cache hit rate or a temperature reading.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
 * <tr><td><a name="minValue"><i>minValue</i></a><td>Object</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
 * <td>MBeanAttributeInfo<br>MBeanParameterInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
 * <td>Minimum legal value for an attribute or parameter.  See
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
 * {@link javax.management.openmbean}.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 * <tr><td><a name="mxbean"><i>mxbean</i></a><td>String</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 * <td>MBeanInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 * <td>The string {@code "true"} or {@code "false"} according as this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 * MBean is an {@link MXBean}.  A Standard MBean or MXBean registered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 * directly with the MBean Server or created using the {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
 * StandardMBean} class will have this field in its MBeanInfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
 * Descriptor.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
 * <tr><td><a name="openType"><i>openType</i></a><td>{@link OpenType}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
 * <td>MBeanAttributeInfo<br>MBeanOperationInfo<br>MBeanParameterInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
 * <td><p>The Open Type of this element.  In the case of {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
 * MBeanAttributeInfo} and {@code MBeanParameterInfo}, this is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
 * Open Type of the attribute or parameter.  In the case of {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
 * MBeanOperationInfo}, it is the Open Type of the return value.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
 * field is set in the Descriptor for all instances of {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
 * OpenMBeanAttributeInfoSupport}, {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
 * OpenMBeanOperationInfoSupport}, and {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
 * OpenMBeanParameterInfoSupport}.  It is also set for attributes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
 * operations, and parameters of MXBeans.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
 * <p>This field can be set for an {@code MBeanNotificationInfo}, in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
 * which case it indicates the Open Type that the {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
 * Notification#getUserData() user data} will have.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
 * <tr><td><a name="originalType"><i>originalType</i></a><td>String</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
 * <td>MBeanAttributeInfo<br>MBeanOperationInfo<br>MBeanParameterInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
 * <td><p>The original Java type of this element as it appeared in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
 * {@link MXBean} interface method that produced this {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
 * MBeanAttributeInfo} (etc).  For example, a method<br> <code>public
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
 * </code> {@link MemoryUsage}<code> getHeapMemoryUsage();</code><br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
 * in an MXBean interface defines an attribute called {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
 * HeapMemoryUsage} of type {@link CompositeData}.  The {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 * originalType} field in the Descriptor for this attribute will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 * the value {@code "java.lang.management.MemoryUsage"}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
 * <p>The format of this string is described in the section <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
 * href="MXBean.html#type-names">Type Names</a> of the MXBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
 * specification.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
 * <tr><td>severity</td><td>String<br>Integer</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
 * <td>MBeanNotificationInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
 * <td>The severity of this notification.  It can be 0 to mean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
 * unknown severity or a value from 1 to 6 representing decreasing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
 * levels of severity.  It can be represented as a decimal string or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
 * an {@code Integer}.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
 * <tr><td>since</td><td>String</td><td>Any</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
 * <td>The version of the information model in which this element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
 * was introduced.  A set of MBeans defined by an application is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
 * collectively called an <em>information model</em>.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
 * application may also define versions of this model, and use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
 * {@code "since"} field to record the version in which an element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
 * first appeared.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
 * <tr><td>units</td><td>String</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
 * <td>MBeanAttributeInfo<br>MBeanParameterInfo<br>MBeanOperationInfo</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
 * <td>The units in which an attribute, parameter, or operation return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
 * value is measured, for example {@code "bytes"} or {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
 * "seconds"}.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
 * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
 * <p>Some additional fields are defined by Model MBeans.  See
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
 * {@link javax.management.modelmbean.ModelMBeanInfo ModelMBeanInfo}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
 * and related classes and the chapter "Model MBeans" of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
 * <a href="http://java.sun.com/products/JavaManagement/download.html">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
 * JMX Specification</a>.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
public interface Descriptor extends Serializable, Cloneable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * Returns the value for a specific field name, or null if no value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * is present for that name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * @param fieldName the field name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * @return the corresponding value, or null if the field is not present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * @exception RuntimeOperationsException if the field name is illegal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    public Object getFieldValue(String fieldName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
            throws RuntimeOperationsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * <p>Sets the value for a specific field name. This will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * modify an existing field or add a new field.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * <p>The field value will be validated before it is set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * If it is not valid, then an exception will be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * The meaning of validity is dependent on the descriptor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * implementation.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * @param fieldName The field name to be set. Cannot be null or empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * @param fieldValue The field value to be set for the field
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * name. Can be null if that is a valid value for the field.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * @exception RuntimeOperationsException if the field name or field value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * is illegal (wrapped exception is {@link IllegalArgumentException}); or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * if the descriptor is immutable (wrapped exception is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * {@link UnsupportedOperationException}).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    public void setField(String fieldName, Object fieldValue)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        throws RuntimeOperationsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * Returns all of the fields contained in this descriptor as a string array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * @return String array of fields in the format <i>fieldName=fieldValue</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * <br>If the value of a field is not a String, then the toString() method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * will be called on it and the returned value, enclosed in parentheses,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * used as the value for the field in the returned array. If the value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * of a field is null, then the value of the field in the returned array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * will be empty.  If the descriptor is empty, you will get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * an empty array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * @see #setFields
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    public String[] getFields();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * Returns all the field names in the descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * @return String array of field names. If the descriptor is empty,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * you will get an empty array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    public String[] getFieldNames();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * Returns all the field values in the descriptor as an array of Objects. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * returned values are in the same order as the {@code fieldNames} String array parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * @param fieldNames String array of the names of the fields that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * the values should be returned for.  If the array is empty then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * an empty array will be returned.  If the array is null then all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * values will be returned, as if the parameter were the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * returned by {@link #getFieldNames()}.  If a field name in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * array does not exist, including the case where it is null or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * the empty string, then null is returned for the matching array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * element being returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * @return Object array of field values. If the list of {@code fieldNames}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * is empty, you will get an empty array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    public Object[] getFieldValues(String... fieldNames);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * Removes a field from the descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * @param fieldName String name of the field to be removed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * If the field name is illegal or the field is not found,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * no exception is thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * @exception RuntimeOperationsException if a field of the given name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * exists and the descriptor is immutable.  The wrapped exception will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * be an {@link UnsupportedOperationException}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    public void removeField(String fieldName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * <p>Sets all fields in the field names array to the new value with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * the same index in the field values array. Array sizes must match.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * <p>The field value will be validated before it is set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * If it is not valid, then an exception will be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * If the arrays are empty, then no change will take effect.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * @param fieldNames String array of field names. The array and array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * elements cannot be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * @param fieldValues Object array of the corresponding field values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * The array cannot be null. Elements of the array can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * @throws RuntimeOperationsException if the change fails for any reason.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * Wrapped exception is {@link IllegalArgumentException} if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * {@code fieldNames} or {@code fieldValues} is null, or if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * the arrays are of different lengths, or if there is an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * illegal value in one of them.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * Wrapped exception is {@link UnsupportedOperationException}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * if the descriptor is immutable, and the call would change
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * its contents.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * @see #getFields
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    public void setFields(String[] fieldNames, Object[] fieldValues)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        throws RuntimeOperationsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * <p>Returns a descriptor which is equal to this descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * Changes to the returned descriptor will have no effect on this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * descriptor, and vice versa.  If this descriptor is immutable,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * it may fulfill this condition by returning itself.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * @exception RuntimeOperationsException for illegal value for field names
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * or field values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * If the descriptor construction fails for any reason, this exception will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * @return A descriptor which is equal to this descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    public Object clone() throws RuntimeOperationsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * Returns true if all of the fields have legal values given their
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * @return true if the values are legal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * @exception RuntimeOperationsException If the validity checking fails for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * any reason, this exception will be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * The method returns false if the descriptor is not valid, but throws
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * this exception if the attempt to determine validity fails.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    public boolean isValid() throws RuntimeOperationsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * Compares this descriptor to the given object.  The objects are equal if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     * the given object is also a Descriptor, and if the two Descriptors have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * the same field names (possibly differing in case) and the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     * associated values.  The respective values for a field in the two
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     * Descriptors are equal if the following conditions hold:</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * <li>If one value is null then the other must be too.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * <li>If one value is a primitive array then the other must be a primitive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * array of the same type with the same elements.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * <li>If one value is an object array then the other must be too and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * {@link Arrays#deepEquals(Object[],Object[])} must return true.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     * <li>Otherwise {@link Object#equals(Object)} must return true.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * @param obj the object to compare with.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     * @return {@code true} if the objects are the same; {@code false}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    public boolean equals(Object obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * <p>Returns the hash code value for this descriptor.  The hash
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * code is computed as the sum of the hash codes for each field in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     * the descriptor.  The hash code of a field with name {@code n}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     * Here {@code h} is the hash code of {@code v}, computed as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * follows:</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * <li>If {@code v} is null then {@code h} is 0.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * <li>If {@code v} is a primitive array then {@code h} is computed using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * <li>If {@code v} is an object array then {@code h} is computed using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * {@link Arrays#deepHashCode(Object[])}.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * @return A hash code value for this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
    public int hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
}