Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/management/Descriptor.java
38829 views
/*1* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24/*25* @author IBM Corp.26*27* Copyright IBM Corp. 1999-2000. All rights reserved.28*/2930package javax.management;3132import java.io.Serializable;3334// Javadoc imports:35import java.lang.management.MemoryUsage;36import java.util.Arrays;37import java.util.Locale;38import java.util.ResourceBundle;39import javax.management.openmbean.CompositeData;40import javax.management.openmbean.OpenMBeanAttributeInfoSupport;41import javax.management.openmbean.OpenMBeanOperationInfoSupport;42import javax.management.openmbean.OpenMBeanParameterInfoSupport;43import javax.management.openmbean.OpenType;4445/**46* <p>Additional metadata for a JMX element. A {@code Descriptor}47* is associated with a {@link MBeanInfo}, {@link MBeanAttributeInfo}, etc.48* It consists of a collection of fields. A field is a name and an49* associated value.</p>50*51* <p>Field names are not case-sensitive. The names {@code descriptorType},52* {@code descriptortype}, and {@code DESCRIPTORTYPE} are all equivalent.53* However, the case that was used when the field was first set is preserved54* in the result of the {@link #getFields} and {@link #getFieldNames}55* methods.</p>56*57* <p>Not all field names and values are predefined.58* New fields can be defined and added by any program.</p>59*60* <p>A descriptor can be mutable or immutable.61* An immutable descriptor, once created, never changes.62* The <code>Descriptor</code> methods that could modify the contents63* of the descriptor will throw an exception64* for an immutable descriptor. Immutable descriptors are usually65* instances of {@link ImmutableDescriptor} or a subclass. Mutable66* descriptors are usually instances of67* {@link javax.management.modelmbean.DescriptorSupport} or a subclass.68*69* <p>Certain fields are used by the JMX implementation. This means70* either that the presence of the field may change the behavior of71* the JMX API or that the field may be set in descriptors returned by72* the JMX API. These fields appear in <i>italics</i> in the table73* below, and each one has a corresponding constant in the {@link JMX}74* class. For example, the field {@code defaultValue} is represented75* by the constant {@link JMX#DEFAULT_VALUE_FIELD}.</p>76*77* <p>Certain other fields have conventional meanings described in the78* table below but they are not required to be understood or set by79* the JMX implementation.</p>80*81* <p>Field names defined by the JMX specification in this and all82* future versions will never contain a period (.). Users can safely83* create their own fields by including a period in the name and be84* sure that these names will not collide with any future version of85* the JMX API. It is recommended to follow the Java package naming86* convention to avoid collisions between field names from different87* origins. For example, a field created by {@code example.com} might88* have the name {@code com.example.interestLevel}.</p>89*90* <p>Note that the values in the {@code defaultValue}, {@code91* legalValues}, {@code maxValue}, and {@code minValue} fields should92* be consistent with the type returned by the {@code getType()}93* method for the associated {@code MBeanAttributeInfo} or {@code94* MBeanParameterInfo}. For MXBeans, this means that they should be95* of the mapped Java type, called <em>opendata</em>(J) in the <a96* href="MXBean.html#mapping-rules">MXBean type mapping rules</a>.</p>97*98* <table border="1" cellpadding="5" summary="Descriptor Fields">99*100* <tr><th>Name</th><th>Type</th><th>Used in</th><th>Meaning</th></tr>101*102* <tr id="defaultValue"><td><i>defaultValue</i><td>Object</td>103* <td>MBeanAttributeInfo<br>MBeanParameterInfo</td>104*105* <td>Default value for an attribute or parameter. See106* {@link javax.management.openmbean}.</td>107*108* <tr><td>deprecated</td><td>String</td><td>Any</td>109*110* <td>An indication that this element of the information model is no111* longer recommended for use. A set of MBeans defined by an112* application is collectively called an <em>information model</em>.113* The convention is for the value of this field to contain a string114* that is the version of the model in which the element was first115* deprecated, followed by a space, followed by an explanation of the116* deprecation, for example {@code "1.3 Replaced by the Capacity117* attribute"}.</td>118*119* <tr><td id="descriptionResourceBundleBaseName">descriptionResource<br>120* BundleBaseName</td><td>String</td><td>Any</td>121*122* <td>The base name for the {@link ResourceBundle} in which the key given in123* the {@code descriptionResourceKey} field can be found, for example124* {@code "com.example.myapp.MBeanResources"}. The meaning of this125* field is defined by this specification but the field is not set or126* used by the JMX API itself.</td>127*128* <tr><td id="descriptionResourceKey">descriptionResourceKey</td>129* <td>String</td><td>Any</td>130*131* <td>A resource key for the description of this element. In132* conjunction with the {@code descriptionResourceBundleBaseName},133* this can be used to find a localized version of the description.134* The meaning of this field is defined by this specification but the135* field is not set or used by the JMX API itself.</td>136*137* <tr><td>enabled</td><td>String</td>138* <td>MBeanAttributeInfo<br>MBeanNotificationInfo<br>MBeanOperationInfo</td>139*140* <td>The string {@code "true"} or {@code "false"} according as this141* item is enabled. When an attribute or operation is not enabled, it142* exists but cannot currently be accessed. A user interface might143* present it as a greyed-out item. For example, an attribute might144* only be meaningful after the {@code start()} method of an MBean has145* been called, and is otherwise disabled. Likewise, a notification146* might be disabled if it cannot currently be emitted but could be in147* other circumstances.</td>148*149* <tr id="exceptions"><td>exceptions<td>String[]</td>150* <td>MBeanAttributeInfo, MBeanConstructorInfo, MBeanOperationInfo</td>151*152* <td>The class names of the exceptions that can be thrown when invoking a153* constructor or operation, or getting an attribute. The meaning of this field154* is defined by this specification but the field is not set or used by the155* JMX API itself. Exceptions thrown when156* setting an attribute are specified by the field157* <a href="#setExceptions">{@code setExceptions}</a>.158*159* <tr id="immutableInfo"><td><i>immutableInfo</i><td>String</td>160* <td>MBeanInfo</td>161*162* <td>The string {@code "true"} or {@code "false"} according as this163* MBean's MBeanInfo is <em>immutable</em>. When this field is true,164* the MBeanInfo for the given MBean is guaranteed not to change over165* the lifetime of the MBean. Hence, a client can read it once and166* cache the read value. When this field is false or absent, there is167* no such guarantee, although that does not mean that the MBeanInfo168* will necessarily change. See also the <a169* href="MBeanInfo.html#info-changed">{@code "jmx.mbean.info.changed"}</a>170* notification.</td>171*172* <tr id="infoTimeout"><td>infoTimeout</td><td>String<br>Long</td><td>MBeanInfo</td>173*174* <td>The time in milli-seconds that the MBeanInfo can reasonably be175* expected to be unchanged. The value can be a {@code Long} or a176* decimal string. This provides a hint from a DynamicMBean or any177* MBean that does not define {@code immutableInfo} as {@code true}178* that the MBeanInfo is not likely to change within this period and179* therefore can be cached. When this field is missing or has the180* value zero, it is not recommended to cache the MBeanInfo unless it181* has the {@code immutableInfo} set to {@code true} or it has <a182* href="MBeanInfo.html#info-changed">{@code "jmx.mbean.info.changed"}</a> in183* its {@link MBeanNotificationInfo} array.</td></tr>184*185* <tr id="interfaceClassName"><td><i>interfaceClassName</i></td>186* <td>String</td><td>MBeanInfo</td>187*188* <td>The Java interface name for a Standard MBean or MXBean, as189* returned by {@link Class#getName()}. A Standard MBean or MXBean190* registered directly in the MBean Server or created using the {@link191* StandardMBean} class will have this field in its MBeanInfo192* Descriptor.</td>193*194* <tr id="legalValues"><td><i>legalValues</i></td>195* <td>{@literal Set<?>}</td><td>MBeanAttributeInfo<br>MBeanParameterInfo</td>196*197* <td>Legal values for an attribute or parameter. See198* {@link javax.management.openmbean}.</td>199*200* <tr id="locale"><td>locale</td>201* <td>String</td><td>Any</td>202*203* <td>The {@linkplain Locale locale} of the description in this204* {@code MBeanInfo}, {@code MBeanAttributeInfo}, etc, as returned205* by {@link Locale#toString()}.</td>206*207* <tr id="maxValue"><td><i>maxValue</i><td>Object</td>208* <td>MBeanAttributeInfo<br>MBeanParameterInfo</td>209*210* <td>Maximum legal value for an attribute or parameter. See211* {@link javax.management.openmbean}.</td>212*213* <tr id="metricType"><td>metricType</td><td>String</td>214* <td>MBeanAttributeInfo<br>MBeanOperationInfo</td>215*216* <td>The type of a metric, one of the strings "counter" or "gauge".217* A metric is a measurement exported by an MBean, usually an218* attribute but sometimes the result of an operation. A metric that219* is a <em>counter</em> has a value that never decreases except by220* being reset to a starting value. Counter metrics are almost always221* non-negative integers. An example might be the number of requests222* received. A metric that is a <em>gauge</em> has a numeric value223* that can increase or decrease. Examples might be the number of224* open connections or a cache hit rate or a temperature reading.225*226* <tr id="minValue"><td><i>minValue</i><td>Object</td>227* <td>MBeanAttributeInfo<br>MBeanParameterInfo</td>228*229* <td>Minimum legal value for an attribute or parameter. See230* {@link javax.management.openmbean}.</td>231*232* <tr id="mxbean"><td><i>mxbean</i><td>String</td>233* <td>MBeanInfo</td>234*235* <td>The string {@code "true"} or {@code "false"} according as this236* MBean is an {@link MXBean}. A Standard MBean or MXBean registered237* directly with the MBean Server or created using the {@link238* StandardMBean} class will have this field in its MBeanInfo239* Descriptor.</td>240*241* <tr id="openType"><td><i>openType</i><td>{@link OpenType}</td>242* <td>MBeanAttributeInfo<br>MBeanOperationInfo<br>MBeanParameterInfo</td>243*244* <td><p>The Open Type of this element. In the case of {@code245* MBeanAttributeInfo} and {@code MBeanParameterInfo}, this is the246* Open Type of the attribute or parameter. In the case of {@code247* MBeanOperationInfo}, it is the Open Type of the return value. This248* field is set in the Descriptor for all instances of {@link249* OpenMBeanAttributeInfoSupport}, {@link250* OpenMBeanOperationInfoSupport}, and {@link251* OpenMBeanParameterInfoSupport}. It is also set for attributes,252* operations, and parameters of MXBeans.</p>253*254* <p>This field can be set for an {@code MBeanNotificationInfo}, in255* which case it indicates the Open Type that the {@link256* Notification#getUserData() user data} will have.</td>257*258* <tr id="originalType"><td><i>originalType</i><td>String</td>259* <td>MBeanAttributeInfo<br>MBeanOperationInfo<br>MBeanParameterInfo</td>260*261* <td><p>The original Java type of this element as it appeared in the262* {@link MXBean} interface method that produced this {@code263* MBeanAttributeInfo} (etc). For example, a method<br> <code>public264* </code> {@link MemoryUsage}<code> getHeapMemoryUsage();</code><br>265* in an MXBean interface defines an attribute called {@code266* HeapMemoryUsage} of type {@link CompositeData}. The {@code267* originalType} field in the Descriptor for this attribute will have268* the value {@code "java.lang.management.MemoryUsage"}.269*270* <p>The format of this string is described in the section <a271* href="MXBean.html#type-names">Type Names</a> of the MXBean272* specification.</p>273*274* <tr id="setExceptions"><td><i>setExceptions</i><td>String[]</td>275* <td>MBeanAttributeInfo</td>276*277* <td>The class names of the exceptions that can be thrown when setting278* an attribute. The meaning of this field279* is defined by this specification but the field is not set or used by the280* JMX API itself. Exceptions thrown when getting an attribute are specified281* by the field <a href="#exceptions">{@code exceptions}</a>.282*283* <tr><td>severity</td><td>String<br>Integer</td>284* <td>MBeanNotificationInfo</td>285*286* <td>The severity of this notification. It can be 0 to mean287* unknown severity or a value from 1 to 6 representing decreasing288* levels of severity. It can be represented as a decimal string or289* an {@code Integer}.</td>290*291* <tr><td>since</td><td>String</td><td>Any</td>292*293* <td>The version of the information model in which this element294* was introduced. A set of MBeans defined by an application is295* collectively called an <em>information model</em>. The296* application may also define versions of this model, and use the297* {@code "since"} field to record the version in which an element298* first appeared.</td>299*300* <tr><td>units</td><td>String</td>301* <td>MBeanAttributeInfo<br>MBeanParameterInfo<br>MBeanOperationInfo</td>302*303* <td>The units in which an attribute, parameter, or operation return304* value is measured, for example {@code "bytes"} or {@code305* "seconds"}.</td>306*307* </table>308*309* <p>Some additional fields are defined by Model MBeans. See the310* information for <a href="modelmbean/ModelMBeanInfo.html#descriptor"><!--311* -->{@code ModelMBeanInfo}</a>,312* <a href="modelmbean/ModelMBeanAttributeInfo.html#descriptor"><!--313* -->{@code ModelMBeanAttributeInfo}</a>,314* <a href="modelmbean/ModelMBeanConstructorInfo.html#descriptor"><!--315* -->{@code ModelMBeanConstructorInfo}</a>,316* <a href="modelmbean/ModelMBeanNotificationInfo.html#descriptor"><!--317* -->{@code ModelMBeanNotificationInfo}</a>, and318* <a href="modelmbean/ModelMBeanOperationInfo.html#descriptor"><!--319* -->{@code ModelMBeanOperationInfo}</a>, as320* well as the chapter "Model MBeans" of the <a321* href="http://www.oracle.com/technetwork/java/javase/tech/javamanagement-140525.html">JMX322* Specification</a>. The following table summarizes these fields. Note323* that when the Type in this table is Number, a String that is the decimal324* representation of a Long can also be used.</p>325*326* <p>Nothing prevents the use of these fields in MBeans that are not Model327* MBeans. The <a href="#displayName">displayName</a>, <a href="#severity"><!--328* -->severity</a>, and <a href="#visibility">visibility</a> fields are of329* interest outside Model MBeans, for example. But only Model MBeans have330* a predefined behavior for these fields.</p>331*332* <table border="1" cellpadding="5" summary="ModelMBean Fields">333*334* <tr><th>Name</th><th>Type</th><th>Used in</th><th>Meaning</th></tr>335*336* <tr><td>class</td><td>String</td><td>ModelMBeanOperationInfo</td>337* <td>Class where method is defined (fully qualified).</td></tr>338*339* <tr><td>currencyTimeLimit</td><td>Number</td>340* <td>ModelMBeanInfo<br>ModelMBeanAttributeInfo<br>ModelMBeanOperationInfo</td>341* <td>How long cached value is valid: <0 never, =0 always,342* >0 seconds.</td></tr>343*344* <tr><td>default</td><td>Object</td><td>ModelMBeanAttributeInfo</td>345* <td>Default value for attribute.</td></tr>346*347* <tr><td>descriptorType</td><td>String</td><td>Any</td>348* <td>Type of descriptor, "mbean", "attribute", "constructor", "operation",349* or "notification".</td></tr>350*351* <tr id="displayName"><td>displayName</td><td>String</td><td>Any</td>352* <td>Human readable name of this item.</td></tr>353*354* <tr><td>export</td><td>String</td><td>ModelMBeanInfo</td>355* <td>Name to be used to export/expose this MBean so that it is356* findable by other JMX Agents.</td></tr>357*358* <tr><td>getMethod</td><td>String</td><td>ModelMBeanAttributeInfo</td>359* <td>Name of operation descriptor for get method.</td></tr>360*361* <tr><td>lastUpdatedTimeStamp</td><td>Number</td>362* <td>ModelMBeanAttributeInfo<br>ModelMBeanOperationInfo</td>363* <td>When <a href="#value-field">value</a> was set.</td></tr>364*365* <tr><td>log</td><td>String</td><td>ModelMBeanInfo<br>ModelMBeanNotificationInfo</td>366* <td>t or T: log all notifications, f or F: log no notifications.</td></tr>367*368* <tr><td>logFile</td><td>String</td><td>ModelMBeanInfo<br>ModelMBeanNotificationInfo</td>369* <td>Fully qualified filename to log events to.</td></tr>370*371* <tr><td>messageID</td><td>String</td><td>ModelMBeanNotificationInfo</td>372* <td>Unique key for message text (to allow translation, analysis).</td></tr>373*374* <tr><td>messageText</td><td>String</td><td>ModelMBeanNotificationInfo</td>375* <td>Text of notification.</td></tr>376*377* <tr><td>name</td><td>String</td><td>Any</td>378* <td>Name of this item.</td></tr>379*380* <tr><td>persistFile</td><td>String</td><td>ModelMBeanInfo</td>381* <td>File name into which the MBean should be persisted.</td></tr>382*383* <tr><td>persistLocation</td><td>String</td><td>ModelMBeanInfo</td>384* <td>The fully qualified directory name where the MBean should be385* persisted (if appropriate).</td></tr>386*387* <tr><td>persistPeriod</td><td>Number</td>388* <td>ModelMBeanInfo<br>ModelMBeanAttributeInfo</td>389* <td>Frequency of persist cycle in seconds. Used when persistPolicy is390* "OnTimer" or "NoMoreOftenThan".</td></tr>391*392* <tr><td>persistPolicy</td><td>String</td>393* <td>ModelMBeanInfo<br>ModelMBeanAttributeInfo</td>394* <td>One of: OnUpdate|OnTimer|NoMoreOftenThan|OnUnregister|Always|Never.395* See the section "MBean Descriptor Fields" in the JMX specification396* document.</td></tr>397*398* <tr><td>presentationString</td><td>String</td><td>Any</td>399* <td>XML formatted string to allow presentation of data.</td></tr>400*401* <tr><td>protocolMap</td><td>Descriptor</td><td>ModelMBeanAttributeInfo</td>402* <td>See the section "Protocol Map Support" in the JMX specification403* document. Mappings must be appropriate for the attribute and entries404* can be updated or augmented at runtime.</td></tr>405*406* <tr><td>role</td><td>String</td>407* <td>ModelMBeanConstructorInfo<br>ModelMBeanOperationInfo</td>408* <td>One of "constructor", "operation", "getter", or "setter".</td></tr>409*410* <tr><td>setMethod</td><td>String</td><td>ModelMBeanAttributeInfo</td>411* <td>Name of operation descriptor for set method.</td></tr>412*413* <tr id="severity"><td>severity</td><td>Number</td>414* <td>ModelMBeanNotificationInfo</td>415* <td>0-6 where 0: unknown; 1: non-recoverable;416* 2: critical, failure; 3: major, severe;417* 4: minor, marginal, error; 5: warning;418* 6: normal, cleared, informative</td></tr>419*420* <tr><td>targetObject</td><td>Object</td><td>ModelMBeanOperationInfo</td>421* <td>Object on which to execute this method.</td></tr>422*423* <tr><td>targetType</td><td>String</td><td>ModelMBeanOperationInfo</td>424* <td>type of object reference for targetObject. Can be:425* ObjectReference | Handle | EJBHandle | IOR | RMIReference.</td></tr>426*427* <tr id="value-field"><td>value</td><td>Object</td>428* <td>ModelMBeanAttributeInfo<br>ModelMBeanOperationInfo</td>429* <td>Current (cached) value for attribute or operation.</td></tr>430*431* <tr id="visibility"><td>visibility</td><td>Number</td><td>Any</td>432* <td>1-4 where 1: always visible, 4: rarely visible.</td></tr>433*434* </table>435*436* @since 1.5437*/438public interface Descriptor extends Serializable, Cloneable439{440441/**442* Returns the value for a specific field name, or null if no value443* is present for that name.444*445* @param fieldName the field name.446*447* @return the corresponding value, or null if the field is not present.448*449* @exception RuntimeOperationsException if the field name is illegal.450*/451public Object getFieldValue(String fieldName)452throws RuntimeOperationsException;453454/**455* <p>Sets the value for a specific field name. This will456* modify an existing field or add a new field.</p>457*458* <p>The field value will be validated before it is set.459* If it is not valid, then an exception will be thrown.460* The meaning of validity is dependent on the descriptor461* implementation.</p>462*463* @param fieldName The field name to be set. Cannot be null or empty.464* @param fieldValue The field value to be set for the field465* name. Can be null if that is a valid value for the field.466*467* @exception RuntimeOperationsException if the field name or field value468* is illegal (wrapped exception is {@link IllegalArgumentException}); or469* if the descriptor is immutable (wrapped exception is470* {@link UnsupportedOperationException}).471*/472public void setField(String fieldName, Object fieldValue)473throws RuntimeOperationsException;474475476/**477* Returns all of the fields contained in this descriptor as a string array.478*479* @return String array of fields in the format <i>fieldName=fieldValue</i>480* <br>If the value of a field is not a String, then the toString() method481* will be called on it and the returned value, enclosed in parentheses,482* used as the value for the field in the returned array. If the value483* of a field is null, then the value of the field in the returned array484* will be empty. If the descriptor is empty, you will get485* an empty array.486*487* @see #setFields488*/489public String[] getFields();490491492/**493* Returns all the field names in the descriptor.494*495* @return String array of field names. If the descriptor is empty,496* you will get an empty array.497*/498public String[] getFieldNames();499500/**501* Returns all the field values in the descriptor as an array of Objects. The502* returned values are in the same order as the {@code fieldNames} String array parameter.503*504* @param fieldNames String array of the names of the fields that505* the values should be returned for. If the array is empty then506* an empty array will be returned. If the array is null then all507* values will be returned, as if the parameter were the array508* returned by {@link #getFieldNames()}. If a field name in the509* array does not exist, including the case where it is null or510* the empty string, then null is returned for the matching array511* element being returned.512*513* @return Object array of field values. If the list of {@code fieldNames}514* is empty, you will get an empty array.515*/516public Object[] getFieldValues(String... fieldNames);517518/**519* Removes a field from the descriptor.520*521* @param fieldName String name of the field to be removed.522* If the field name is illegal or the field is not found,523* no exception is thrown.524*525* @exception RuntimeOperationsException if a field of the given name526* exists and the descriptor is immutable. The wrapped exception will527* be an {@link UnsupportedOperationException}.528*/529public void removeField(String fieldName);530531/**532* <p>Sets all fields in the field names array to the new value with533* the same index in the field values array. Array sizes must match.</p>534*535* <p>The field value will be validated before it is set.536* If it is not valid, then an exception will be thrown.537* If the arrays are empty, then no change will take effect.</p>538*539* @param fieldNames String array of field names. The array and array540* elements cannot be null.541* @param fieldValues Object array of the corresponding field values.542* The array cannot be null. Elements of the array can be null.543*544* @throws RuntimeOperationsException if the change fails for any reason.545* Wrapped exception is {@link IllegalArgumentException} if546* {@code fieldNames} or {@code fieldValues} is null, or if547* the arrays are of different lengths, or if there is an548* illegal value in one of them.549* Wrapped exception is {@link UnsupportedOperationException}550* if the descriptor is immutable, and the call would change551* its contents.552*553* @see #getFields554*/555public void setFields(String[] fieldNames, Object[] fieldValues)556throws RuntimeOperationsException;557558559/**560* <p>Returns a descriptor which is equal to this descriptor.561* Changes to the returned descriptor will have no effect on this562* descriptor, and vice versa. If this descriptor is immutable,563* it may fulfill this condition by returning itself.</p>564* @exception RuntimeOperationsException for illegal value for field names565* or field values.566* If the descriptor construction fails for any reason, this exception will567* be thrown.568* @return A descriptor which is equal to this descriptor.569*/570public Object clone() throws RuntimeOperationsException;571572573/**574* Returns true if all of the fields have legal values given their575* names.576*577* @return true if the values are legal.578*579* @exception RuntimeOperationsException If the validity checking fails for580* any reason, this exception will be thrown.581* The method returns false if the descriptor is not valid, but throws582* this exception if the attempt to determine validity fails.583*/584public boolean isValid() throws RuntimeOperationsException;585586/**587* <p>Compares this descriptor to the given object. The objects are equal if588* the given object is also a Descriptor, and if the two Descriptors have589* the same field names (possibly differing in case) and the same590* associated values. The respective values for a field in the two591* Descriptors are equal if the following conditions hold:</p>592*593* <ul>594* <li>If one value is null then the other must be too.</li>595* <li>If one value is a primitive array then the other must be a primitive596* array of the same type with the same elements.</li>597* <li>If one value is an object array then the other must be too and598* {@link Arrays#deepEquals(Object[],Object[])} must return true.</li>599* <li>Otherwise {@link Object#equals(Object)} must return true.</li>600* </ul>601*602* @param obj the object to compare with.603*604* @return {@code true} if the objects are the same; {@code false}605* otherwise.606*607* @since 1.6608*/609public boolean equals(Object obj);610611/**612* <p>Returns the hash code value for this descriptor. The hash613* code is computed as the sum of the hash codes for each field in614* the descriptor. The hash code of a field with name {@code n}615* and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.616* Here {@code h} is the hash code of {@code v}, computed as617* follows:</p>618*619* <ul>620* <li>If {@code v} is null then {@code h} is 0.</li>621* <li>If {@code v} is a primitive array then {@code h} is computed using622* the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>623* <li>If {@code v} is an object array then {@code h} is computed using624* {@link Arrays#deepHashCode(Object[])}.</li>625* <li>Otherwise {@code h} is {@code v.hashCode()}.</li>626* </ul>627*628* @return A hash code value for this object.629*630* @since 1.6631*/632public int hashCode();633}634635636