Source for javax.management.openmbean.OpenMBeanParameterInfo

   1: /* OpenMBeanParameterInfo.java -- Open typed info about a parameter.
   2:    Copyright (C) 2006 Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: package javax.management.openmbean;
  39: 
  40: import java.util.Set;
  41: 
  42: /**
  43:  * Describes the parameters of a constructor or operation associated
  44:  * with an open management bean.  This interface includes those methods
  45:  * specified by {@link javax.management.MBeanParameterInfo}, so
  46:  * implementations should extend this class.
  47:  *
  48:  * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
  49:  * @since 1.5
  50:  */
  51: public interface OpenMBeanParameterInfo
  52: {
  53: 
  54:   /**
  55:    * Compares this parameter with the supplied object.  This returns
  56:    * true iff the object is an instance of {@link OpenMBeanParameterInfo}
  57:    * with an equal name and open type and the same default, minimum,
  58:    * maximum and legal values.
  59:    *
  60:    * @param obj the object to compare.
  61:    * @return true if the object is a {@link OpenMBeanParameterInfo}
  62:    *         instance, 
  63:    *         <code>name.equals(object.getName())</code>,
  64:    *         <code>openType.equals(object.getOpenType())</code>,
  65:    *         <code>defaultValue.equals(object.getDefaultValue())</code>,
  66:    *         <code>minValue.equals(object.getMinValue())</code>,
  67:    *         <code>maxValue.equals(object.getMaxValue())</code>,
  68:    *         and <code>legalValues.equals(object.getLegalValues())</code>.
  69:    */
  70:   boolean equals(Object obj);
  71: 
  72:   /**
  73:    * Returns the default value of this parameter, or <code>null</code>
  74:    * if there is no default value.
  75:    *
  76:    * @return the default value of the parameter, or <code>null</code>
  77:    *         if there is no default.
  78:    */
  79:   Object getDefaultValue();
  80: 
  81:   /**
  82:    * Returns a description of this parameter.
  83:    *
  84:    * @return a human-readable description.
  85:    */
  86:   String getDescription();
  87: 
  88:   /**
  89:    * Returns a {@link java.util.Set} enumerating the legal values
  90:    * of this parameter, or <code>null</code> if no such limited
  91:    * set exists for this parameter.
  92:    *
  93:    * @return a set of legal values, or <code>null</code> if no such
  94:    *         set exists.
  95:    */
  96:   Set<?> getLegalValues();
  97: 
  98:   /**
  99:    * Returns the maximum value of this parameter, or <code>null</code>
 100:    * if there is no maximum.
 101:    *
 102:    * @return the maximum value, or <code>null</code> if none exists.
 103:    */
 104:   Comparable<?> getMaxValue();
 105: 
 106:   /**
 107:    * Returns the minimum value of this parameter, or <code>null</code>
 108:    * if there is no minimum.
 109:    *
 110:    * @return the minimum value, or <code>null</code> if none exists.
 111:    */
 112:   Comparable<?> getMinValue();
 113: 
 114:   /**
 115:    * Returns the name of this parameter.
 116:    *
 117:    * @return the name of the parameter.
 118:    */
 119:   String getName();
 120: 
 121:   /**
 122:    * Returns the open type instance which represents the type of this
 123:    * parameter.
 124:    *
 125:    * @return the open type of this parameter.
 126:    */
 127:   OpenType<?> getOpenType();
 128: 
 129:   /**
 130:    * Returns true if this parameter has a default value.
 131:    *
 132:    * @return true if this parameter has a default.
 133:    */
 134:   boolean hasDefaultValue();
 135: 
 136:   /**
 137:    * Returns the hashcode of the parameter information as the sum of
 138:    * the hashcodes of the name, open type, default value, maximum
 139:    * value, minimum value and the set of legal values.
 140:    *
 141:    * @return the hashcode of the parameter information.
 142:    */
 143:   int hashCode();
 144: 
 145:   /**
 146:    * Returns true if there is a set of legal values for this
 147:    * parameter.
 148:    *
 149:    * @return true if a set of legal values exists for this
 150:    *         parameter.
 151:    */
 152:   boolean hasLegalValues();
 153: 
 154:   /**
 155:    * Returns true if there is a maximum value for this parameter.
 156:    *
 157:    * @return true if a maximum value exists for this parameter.
 158:    */
 159:   boolean hasMaxValue();
 160: 
 161:   /**
 162:    * Returns true if there is a minimum value for this parameter.
 163:    *
 164:    * @return true if a minimum value exists for this parameter.
 165:    */
 166:   boolean hasMinValue();
 167: 
 168:   /**
 169:    * Returns true if the specified object is a valid value for
 170:    * this parameter.
 171:    *
 172:    * @param obj the object to test.
 173:    * @return true if <code>obj</code> is a valid value for this
 174:    *         parameter.
 175:    */
 176:   boolean isValue(Object obj);
 177: 
 178:   /**
 179:    * Returns a textual representation of this instance.  This
 180:    * is constructed using the class name
 181:    * (<code>javax.management.openmbean.OpenMBeanParameterInfo</code>)
 182:    * along with the name, open type, default, minimum, maximum
 183:    * and legal values of the parameter.
 184:    *
 185:    * @return a @link{java.lang.String} instance representing
 186:    *         the instance in textual form.
 187:    */
 188:   String toString();
 189: 
 190: }