001 /*
002 * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package javax.management.openmbean;
027
028 // java import
029 //
030 import java.util.Set;
031 import java.lang.Comparable; // to be substituted for jdk1.1.x
032
033 // jmx import
034 //
035
036 /**
037 * <p>Describes a parameter used in one or more operations or
038 * constructors of an open MBean.</p>
039 *
040 * <p>This interface declares the same methods as the class {@link
041 * javax.management.MBeanParameterInfo}. A class implementing this
042 * interface (typically {@link OpenMBeanParameterInfoSupport}) should
043 * extend {@link javax.management.MBeanParameterInfo}.</p>
044 *
045 *
046 * @since 1.5
047 */
048 public interface OpenMBeanParameterInfo {
049
050 // Re-declares methods that are in class MBeanParameterInfo of JMX 1.0
051 // (these will be removed when MBeanParameterInfo is made a parent interface of this interface)
052
053 /**
054 * Returns a human readable description of the parameter
055 * described by this <tt>OpenMBeanParameterInfo</tt> instance.
056 *
057 * @return the description.
058 */
059 public String getDescription();
060
061 /**
062 * Returns the name of the parameter
063 * described by this <tt>OpenMBeanParameterInfo</tt> instance.
064 *
065 * @return the name.
066 */
067 public String getName();
068
069 // Now declares methods that are specific to open MBeans
070 //
071
072 /**
073 * Returns the <i>open type</i> of the values of the parameter
074 * described by this <tt>OpenMBeanParameterInfo</tt> instance.
075 *
076 * @return the open type.
077 */
078 public OpenType<?> getOpenType();
079
080 /**
081 * Returns the default value for this parameter, if it has one, or
082 * <tt>null</tt> otherwise.
083 *
084 * @return the default value.
085 */
086 public Object getDefaultValue();
087
088 /**
089 * Returns the set of legal values for this parameter, if it has
090 * one, or <tt>null</tt> otherwise.
091 *
092 * @return the set of legal values.
093 */
094 public Set<?> getLegalValues();
095
096 /**
097 * Returns the minimal value for this parameter, if it has one, or
098 * <tt>null</tt> otherwise.
099 *
100 * @return the minimum value.
101 */
102 public Comparable<?> getMinValue();
103
104 /**
105 * Returns the maximal value for this parameter, if it has one, or
106 * <tt>null</tt> otherwise.
107 *
108 * @return the maximum value.
109 */
110 public Comparable<?> getMaxValue();
111
112 /**
113 * Returns <tt>true</tt> if this parameter has a specified default
114 * value, or <tt>false</tt> otherwise.
115 *
116 * @return true if there is a default value.
117 */
118 public boolean hasDefaultValue();
119
120 /**
121 * Returns <tt>true</tt> if this parameter has a specified set of
122 * legal values, or <tt>false</tt> otherwise.
123 *
124 * @return true if there is a set of legal values.
125 */
126 public boolean hasLegalValues();
127
128 /**
129 * Returns <tt>true</tt> if this parameter has a specified minimal
130 * value, or <tt>false</tt> otherwise.
131 *
132 * @return true if there is a minimum value.
133 */
134 public boolean hasMinValue();
135
136 /**
137 * Returns <tt>true</tt> if this parameter has a specified maximal
138 * value, or <tt>false</tt> otherwise.
139 *
140 * @return true if there is a maximum value.
141 */
142 public boolean hasMaxValue();
143
144 /**
145 * Tests whether <var>obj</var> is a valid value for the parameter
146 * described by this <code>OpenMBeanParameterInfo</code> instance.
147 *
148 * @param obj the object to be tested.
149 *
150 * @return <code>true</code> if <var>obj</var> is a valid value
151 * for the parameter described by this
152 * <code>OpenMBeanParameterInfo</code> instance,
153 * <code>false</code> otherwise.
154 */
155 public boolean isValue(Object obj);
156
157 /**
158 * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanParameterInfo</code> instance for equality.
159 * <p>
160 * Returns <tt>true</tt> if and only if all of the following statements are true:
161 * <ul>
162 * <li><var>obj</var> is non null,</li>
163 * <li><var>obj</var> also implements the <code>OpenMBeanParameterInfo</code> interface,</li>
164 * <li>their names are equal</li>
165 * <li>their open types are equal</li>
166 * <li>their default, min, max and legal values are equal.</li>
167 * </ul>
168 * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
169 * different implementations of the <code>OpenMBeanParameterInfo</code> interface.
170 * <br>
171 * @param obj the object to be compared for equality with this <code>OpenMBeanParameterInfo</code> instance;
172 *
173 * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanParameterInfo</code> instance.
174 */
175 public boolean equals(Object obj);
176
177 /**
178 * Returns the hash code value for this <code>OpenMBeanParameterInfo</code> instance.
179 * <p>
180 * The hash code of an <code>OpenMBeanParameterInfo</code> instance is the sum of the hash codes
181 * of all elements of information used in <code>equals</code> comparisons
182 * (ie: its name, its <i>open type</i>, and its default, min, max and legal values).
183 * <p>
184 * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
185 * for any two <code>OpenMBeanParameterInfo</code> instances <code>t1</code> and <code>t2</code>,
186 * as required by the general contract of the method
187 * {@link Object#hashCode() Object.hashCode()}.
188 * <p>
189 *
190 * @return the hash code value for this <code>OpenMBeanParameterInfo</code> instance
191 */
192 public int hashCode();
193
194 /**
195 * Returns a string representation of this <code>OpenMBeanParameterInfo</code> instance.
196 * <p>
197 * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanParameterInfo</code>),
198 * the string representation of the name and open type of the described parameter,
199 * and the string representation of its default, min, max and legal values.
200 *
201 * @return a string representation of this <code>OpenMBeanParameterInfo</code> instance
202 */
203 public String toString();
204
205 }
|