1. /*
  2. * @(#)OpenMBeanParameterInfo.java 3.21 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.management.openmbean;
  8. // java import
  9. //
  10. import java.util.Set;
  11. import java.lang.Comparable; // to be substituted for jdk1.1.x
  12. // jmx import
  13. //
  14. /**
  15. * <p>Describes a parameter used in one or more operations or
  16. * constructors of an open MBean.</p>
  17. *
  18. * <p>This interface declares the same methods as the class {@link
  19. * javax.management.MBeanParameterInfo}. A class implementing this
  20. * interface (typically {@link OpenMBeanParameterInfoSupport}) should
  21. * extend {@link javax.management.MBeanParameterInfo}.</p>
  22. *
  23. * @version 3.21 03/12/19
  24. * @author Sun Microsystems, Inc.
  25. *
  26. * @since 1.5
  27. * @since.unbundled JMX 1.1
  28. */
  29. public interface OpenMBeanParameterInfo {
  30. // Re-declares methods that are in class MBeanParameterInfo of JMX 1.0
  31. // (these will be removed when MBeanParameterInfo is made a parent interface of this interface)
  32. /**
  33. * Returns a human readable description of the parameter
  34. * described by this <tt>OpenMBeanParameterInfo</tt> instance.
  35. *
  36. * @return the description.
  37. */
  38. public String getDescription() ;
  39. /**
  40. * Returns the name of the parameter
  41. * described by this <tt>OpenMBeanParameterInfo</tt> instance.
  42. *
  43. * @return the name.
  44. */
  45. public String getName() ;
  46. // Now declares methods that are specific to open MBeans
  47. //
  48. /**
  49. * Returns the <i>open type</i> of the values of the parameter
  50. * described by this <tt>OpenMBeanParameterInfo</tt> instance.
  51. *
  52. * @return the open type.
  53. */
  54. public OpenType getOpenType() ;
  55. /**
  56. * Returns the default value for this parameter, if it has one, or
  57. * <tt>null</tt> otherwise.
  58. *
  59. * @return the default value.
  60. */
  61. public Object getDefaultValue() ;
  62. /**
  63. * Returns the set of legal values for this parameter, if it has
  64. * one, or <tt>null</tt> otherwise.
  65. *
  66. * @return the set of legal values.
  67. */
  68. public Set getLegalValues() ;
  69. /**
  70. * Returns the minimal value for this parameter, if it has one, or
  71. * <tt>null</tt> otherwise.
  72. *
  73. * @return the minimum value.
  74. */
  75. public Comparable getMinValue() ;
  76. /**
  77. * Returns the maximal value for this parameter, if it has one, or
  78. * <tt>null</tt> otherwise.
  79. *
  80. * @return the maximum value.
  81. */
  82. public Comparable getMaxValue() ;
  83. /**
  84. * Returns <tt>true</tt> if this parameter has a specified default
  85. * value, or <tt>false</tt> otherwise.
  86. *
  87. * @return true if there is a default value.
  88. */
  89. public boolean hasDefaultValue() ;
  90. /**
  91. * Returns <tt>true</tt> if this parameter has a specified set of
  92. * legal values, or <tt>false</tt> otherwise.
  93. *
  94. * @return true if there is a set of legal values.
  95. */
  96. public boolean hasLegalValues() ;
  97. /**
  98. * Returns <tt>true</tt> if this parameter has a specified minimal
  99. * value, or <tt>false</tt> otherwise.
  100. *
  101. * @return true if there is a minimum value.
  102. */
  103. public boolean hasMinValue() ;
  104. /**
  105. * Returns <tt>true</tt> if this parameter has a specified maximal
  106. * value, or <tt>false</tt> otherwise.
  107. *
  108. * @return true if there is a maximum value.
  109. */
  110. public boolean hasMaxValue() ;
  111. /**
  112. * Tests whether <var>obj</var> is a valid value for the parameter
  113. * described by this <code>OpenMBeanParameterInfo</code> instance.
  114. *
  115. * @param obj the object to be tested.
  116. *
  117. * @return <code>true</code> if <var>obj</var> is a valid value
  118. * for for the parameter described by this
  119. * <code>OpenMBeanParameterInfo</code> instance,
  120. * <code>false</code> otherwise.
  121. */
  122. public boolean isValue(Object obj) ;
  123. /**
  124. * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanParameterInfo</code> instance for equality.
  125. * <p>
  126. * Returns <tt>true</tt> if and only if all of the following statements are true:
  127. * <ul>
  128. * <li><var>obj</var> is non null,</li>
  129. * <li><var>obj</var> also implements the <code>OpenMBeanParameterInfo</code> interface,</li>
  130. * <li>their names are equal</li>
  131. * <li>their open types are equal</li>
  132. * <li>their default, min, max and legal values are equal.</li>
  133. * </ul>
  134. * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
  135. * different implementations of the <code>OpenMBeanParameterInfo</code> interface.
  136. * <br> 
  137. * @param obj the object to be compared for equality with this <code>OpenMBeanParameterInfo</code> instance;
  138. *
  139. * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanParameterInfo</code> instance.
  140. */
  141. public boolean equals(Object obj);
  142. /**
  143. * Returns the hash code value for this <code>OpenMBeanParameterInfo</code> instance.
  144. * <p>
  145. * The hash code of an <code>OpenMBeanParameterInfo</code> instance is the sum of the hash codes
  146. * of all elements of information used in <code>equals</code> comparisons
  147. * (ie: its name, its <i>open type</i>, and its default, min, max and legal values).
  148. * <p>
  149. * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
  150. * for any two <code>OpenMBeanParameterInfo</code> instances <code>t1</code> and <code>t2</code>,
  151. * as required by the general contract of the method
  152. * {@link Object#hashCode() Object.hashCode()}.
  153. * <p>
  154. *
  155. * @return the hash code value for this <code>OpenMBeanParameterInfo</code> instance
  156. */
  157. public int hashCode();
  158. /**
  159. * Returns a string representation of this <code>OpenMBeanParameterInfo</code> instance.
  160. * <p>
  161. * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanParameterInfo</code>),
  162. * the string representation of the name and open type of the described parameter,
  163. * and the string representation of its default, min, max and legal values.
  164. *
  165. * @return a string representation of this <code>OpenMBeanParameterInfo</code> instance
  166. */
  167. public String toString();
  168. }