/** * Returns the hash code value for this {@code OpenMBeanParameterInfoSupport} instance. * * <p>The hash code of an {@code OpenMBeanParameterInfoSupport} instance is the sum of the hash * codes of all elements of information used in {@code equals} comparisons (ie: its name, its * <i>open type</i>, its default, min, max and legal values, and its Descriptor). * * <p>This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()} * for any two {@code OpenMBeanParameterInfoSupport} instances {@code t1} and {@code t2}, as * required by the general contract of the method {@link Object#hashCode() Object.hashCode()}. * * <p>However, note that another instance of a class implementing the {@code * OpenMBeanParameterInfo} interface may be equal to this {@code OpenMBeanParameterInfoSupport} * instance as defined by {@link #equals(java.lang.Object)}, but may have a different hash code if * it is calculated differently. * * <p>As {@code OpenMBeanParameterInfoSupport} instances are immutable, the hash code for this * instance is calculated once, on the first call to {@code hashCode}, and then the same value is * returned for subsequent calls. * * @return the hash code value for this {@code OpenMBeanParameterInfoSupport} instance */ public int hashCode() { // Calculate the hash code value if it has not yet been done // (ie 1st call to hashCode()) // if (myHashCode == null) myHashCode = OpenMBeanAttributeInfoSupport.hashCode(this); // return always the same hash code for this instance (immutable) // return myHashCode.intValue(); }
/** * Returns a string representation of this {@code OpenMBeanParameterInfoSupport} instance. * * <p>The string representation consists of the name of this class (i.e. {@code * javax.management.openmbean.OpenMBeanParameterInfoSupport}), the string representation of the * name and open type of the described parameter, the string representation of its default, min, * max and legal values and the string representation of its descriptor. * * <p>As {@code OpenMBeanParameterInfoSupport} instances are immutable, the string representation * for this instance is calculated once, on the first call to {@code toString}, and then the same * value is returned for subsequent calls. * * @return a string representation of this {@code OpenMBeanParameterInfoSupport} instance. */ public String toString() { // Calculate the string value if it has not yet been done (ie // 1st call to toString()) // if (myToString == null) myToString = OpenMBeanAttributeInfoSupport.toString(this); // return always the same string representation for this // instance (immutable) // return myToString; }
/** * Tests whether {@code obj} is a valid value for the parameter described by this {@code * OpenMBeanParameterInfo} instance. * * @param obj the object to be tested. * @return {@code true} if {@code obj} is a valid value for the parameter described by this {@code * OpenMBeanParameterInfo} instance, {@code false} otherwise. */ public boolean isValue(Object obj) { return OpenMBeanAttributeInfoSupport.isValue(this, obj); // compiler bug? should be able to omit class name here // also below in toString and hashCode }