001/* OpenMBeanParameterInfo.java -- Open typed info about a parameter. 002 Copyright (C) 2006 Free Software Foundation, Inc. 003 004This file is part of GNU Classpath. 005 006GNU Classpath is free software; you can redistribute it and/or modify 007it under the terms of the GNU General Public License as published by 008the Free Software Foundation; either version 2, or (at your option) 009any later version. 010 011GNU Classpath is distributed in the hope that it will be useful, but 012WITHOUT ANY WARRANTY; without even the implied warranty of 013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014General Public License for more details. 015 016You should have received a copy of the GNU General Public License 017along with GNU Classpath; see the file COPYING. If not, write to the 018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 01902110-1301 USA. 020 021Linking this library statically or dynamically with other modules is 022making a combined work based on this library. Thus, the terms and 023conditions of the GNU General Public License cover the whole 024combination. 025 026As a special exception, the copyright holders of this library give you 027permission to link this library with independent modules to produce an 028executable, regardless of the license terms of these independent 029modules, and to copy and distribute the resulting executable under 030terms of your choice, provided that you also meet, for each linked 031independent module, the terms and conditions of the license of that 032module. An independent module is a module which is not derived from 033or based on this library. If you modify this library, you may extend 034this exception to your version of the library, but you are not 035obligated to do so. If you do not wish to do so, delete this 036exception statement from your version. */ 037 038package javax.management.openmbean; 039 040import java.util.Set; 041 042/** 043 * Describes the parameters of a constructor or operation associated 044 * with an open management bean. This interface includes those methods 045 * specified by {@link javax.management.MBeanParameterInfo}, so 046 * implementations should extend this class. 047 * 048 * @author Andrew John Hughes (gnu_andrew@member.fsf.org) 049 * @since 1.5 050 */ 051public interface OpenMBeanParameterInfo 052{ 053 054 /** 055 * Compares this parameter with the supplied object. This returns 056 * true iff the object is an instance of {@link OpenMBeanParameterInfo} 057 * with an equal name and open type and the same default, minimum, 058 * maximum and legal values. 059 * 060 * @param obj the object to compare. 061 * @return true if the object is a {@link OpenMBeanParameterInfo} 062 * instance, 063 * <code>name.equals(object.getName())</code>, 064 * <code>openType.equals(object.getOpenType())</code>, 065 * <code>defaultValue.equals(object.getDefaultValue())</code>, 066 * <code>minValue.equals(object.getMinValue())</code>, 067 * <code>maxValue.equals(object.getMaxValue())</code>, 068 * and <code>legalValues.equals(object.getLegalValues())</code>. 069 */ 070 boolean equals(Object obj); 071 072 /** 073 * Returns the default value of this parameter, or <code>null</code> 074 * if there is no default value. 075 * 076 * @return the default value of the parameter, or <code>null</code> 077 * if there is no default. 078 */ 079 Object getDefaultValue(); 080 081 /** 082 * Returns a description of this parameter. 083 * 084 * @return a human-readable description. 085 */ 086 String getDescription(); 087 088 /** 089 * Returns a {@link java.util.Set} enumerating the legal values 090 * of this parameter, or <code>null</code> if no such limited 091 * set exists for this parameter. 092 * 093 * @return a set of legal values, or <code>null</code> if no such 094 * set exists. 095 */ 096 Set<?> getLegalValues(); 097 098 /** 099 * 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}