001: /* JFox, the OpenSource J2EE Application Server
002: *
003: * Copyright (C) 2002 huihoo.org
004: * Distributable under GNU LGPL license
005: * See the GNU Lesser General Public License for more details.
006: */
007:
008: package javax.management.openmbean;
009:
010: import java.util.Set;
011:
012: /**
013: * <p>Describes a parameter used in one or more operations or
014: * constructors of an open MBean.</p>
015: *
016: * <p>This interface declares the same methods as the class {@link
017: * javax.management.MBeanParameterInfo}. A class implementing this
018: * interface (typically {@link OpenMBeanParameterInfoSupport}) should
019: * extend {@link javax.management.MBeanParameterInfo}.</p>
020: *
021: * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
022: */
023:
024: public interface OpenMBeanParameterInfo {
025:
026: // Re-declares methods that are in class MBeanParameterInfo of JMX 1.0
027: // (these will be removed when MBeanParameterInfo is made a parent interface of this interface)
028:
029: /**
030: * Returns a human readable description of the parameter
031: * described by this <tt>OpenMBeanParameterInfo</tt> instance.
032: *
033: * @return the description.
034: */
035: public String getDescription();
036:
037: /**
038: * Returns the name of the parameter
039: * described by this <tt>OpenMBeanParameterInfo</tt> instance.
040: *
041: * @return the name.
042: */
043: public String getName();
044:
045: // Now declares methods that are specific to open MBeans
046: //
047:
048: /**
049: * Returns the <i>open type</i> of the values of the parameter
050: * described by this <tt>OpenMBeanParameterInfo</tt> instance.
051: *
052: * @return the open type.
053: */
054: public OpenType getOpenType();
055:
056: /**
057: * Returns the default value for this parameter, if it has one, or
058: * <tt>null</tt> otherwise.
059: *
060: * @return the default value.
061: */
062: public Object getDefaultValue();
063:
064: /**
065: * Returns the set of legal values for this parameter, if it has
066: * one, or <tt>null</tt> otherwise.
067: *
068: * @return the set of legal values.
069: */
070: public Set getLegalValues();
071:
072: /**
073: * Returns the minimal value for this parameter, if it has one, or
074: * <tt>null</tt> otherwise.
075: *
076: * @return the minimum value.
077: */
078: public Comparable getMinValue();
079:
080: /**
081: * Returns the maximal value for this parameter, if it has one, or
082: * <tt>null</tt> otherwise.
083: *
084: * @return the maximum value.
085: */
086: public Comparable getMaxValue();
087:
088: /**
089: * Returns <tt>true</tt> if this parameter has a specified default
090: * value, or <tt>false</tt> otherwise.
091: *
092: * @return true if there is a default value.
093: */
094: public boolean hasDefaultValue();
095:
096: /**
097: * Returns <tt>true</tt> if this parameter has a specified set of
098: * legal values, or <tt>false</tt> otherwise.
099: *
100: * @return true if there is a set of legal values.
101: */
102: public boolean hasLegalValues();
103:
104: /**
105: * Returns <tt>true</tt> if this parameter has a specified minimal
106: * value, or <tt>false</tt> otherwise.
107: *
108: * @return true if there is a minimum value.
109: */
110: public boolean hasMinValue();
111:
112: /**
113: * Returns <tt>true</tt> if this parameter has a specified maximal
114: * value, or <tt>false</tt> otherwise.
115: *
116: * @return true if there is a maximum value.
117: */
118: public boolean hasMaxValue();
119:
120: /**
121: * Tests whether <var>obj</var> is a valid value for the parameter
122: * described by this <code>OpenMBeanParameterInfo</code> instance.
123: *
124: * @param obj the object to be tested.
125: *
126: * @return <code>true</code> if <var>obj</var> is a valid value
127: * for for the parameter described by this
128: * <code>OpenMBeanParameterInfo</code> instance,
129: * <code>false</code> otherwise.
130: */
131: public boolean isValue(Object obj);
132:
133: /**
134: * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanParameterInfo</code> instance for equality.
135: * <p>
136: * Returns <tt>true</tt> if and only if all of the following statements are true:
137: * <ul>
138: * <li><var>obj</var> is non null,</li>
139: * <li><var>obj</var> also implements the <code>OpenMBeanParameterInfo</code> interface,</li>
140: * <li>their names are equal</li>
141: * <li>their open types are equal</li>
142: * <li>their default, min, max and legal values are equal.</li>
143: * </ul>
144: * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
145: * different implementations of the <code>OpenMBeanParameterInfo</code> interface.
146: * <br>
147: * @param obj the object to be compared for equality with this <code>OpenMBeanParameterInfo</code> instance;
148: *
149: * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanParameterInfo</code> instance.
150: */
151: public boolean equals(Object obj);
152:
153: /**
154: * Returns the hash code value for this <code>OpenMBeanParameterInfo</code> instance.
155: * <p>
156: * The hash code of an <code>OpenMBeanParameterInfo</code> instance is the sum of the hash codes
157: * of all elements of information used in <code>equals</code> comparisons
158: * (ie: its name, its <i>open type</i>, and its default, min, max and legal values).
159: * <p>
160: * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
161: * for any two <code>OpenMBeanParameterInfo</code> instances <code>t1</code> and <code>t2</code>,
162: * as required by the general contract of the method
163: * {@link <a href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#hashCode()">
164: * <code>Object.hashCode</code> </a>}.
165: * <p>
166: *
167: * @return the hash code value for this <code>OpenMBeanParameterInfo</code> instance
168: */
169: public int hashCode();
170:
171: /**
172: * Returns a string representation of this <code>OpenMBeanParameterInfo</code> instance.
173: * <p>
174: * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanParameterInfo</code>),
175: * the string representation of the name and open type of the described parameter,
176: * and the string representation of its default, min, max and legal values.
177: *
178: * @return a string representation of this <code>OpenMBeanParameterInfo</code> instance
179: */
180: public String toString();
181:
182: }
|