001/* OpenMBeanAttributeInfo.java -- Open typed info about an attribute.
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
040/**
041 * Describes an attribute associated with an open management bean.
042 * This interface includes those methods specified by {@link
043 * javax.management.MBeanAttributeInfo}, so implementations should
044 * extend this class.
045 *
046 * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
047 * @since 1.5
048 */
049public interface OpenMBeanAttributeInfo
050  extends OpenMBeanParameterInfo
051{
052
053  /**
054   * Compares this attribute with the supplied object.  This returns
055   * true iff the object is an instance of {@link OpenMBeanAttributeInfo}
056   * with an equal name and open type, the same default, minimum,
057   * maximum and legal values and the same access properties
058   * ({@link #isIs()}, {@link #isReadable()}, {@link #isWritable()}).
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   *         <code>legalValues.equals(object.getLegalValues())</code>,
069   *         <code>is == object.isIs()</code>,
070   *         <code>isRead == object.isReadable()</code>,
071   *         and <code>isWrite == object.isWritable()</code>.
072   */
073  boolean equals(Object obj);
074
075  /**
076   * Returns the hashcode of the attribute information as the sum of
077   * the hashcodes of the name, open type, default value, maximum
078   * value, minimum value, the set of legal values and the access
079   * properties.
080   *
081   * @return the hashcode of the attribute information.
082   */
083  int hashCode();
084
085  /**
086   * Returns true if the accessor method of this attribute
087   * is of the form <code>isXXX</code>.
088   *
089   * @return true if the accessor takes the form <code>isXXX</code>.
090   */
091  boolean isIs();
092
093  /**
094   * Returns true if value of this attribute can be read.
095   *
096   * @return true if the value of the attribute can be read.
097   */
098  boolean isReadable();
099
100  /**
101   * Returns true if the value of this attribute can be changed.
102   *
103   * @return true if the value of the attribute can be changed.
104   */
105  boolean isWritable();
106
107  /**
108   * Returns a textual representation of this instance.  This
109   * is constructed using the class name
110   * (<code>javax.management.openmbean.OpenMBeanAttributeInfo</code>)
111   * along with the name, open type, default, minimum, maximum
112   * and legal values of the parameter and the access permissions
113   * ({@link #isIs()}, {@link #isReadable()}, {@link #isWritable()}).
114   *
115   * @return a @link{java.lang.String} instance representing
116   *         the instance in textual form.
117   */
118  String toString();
119
120}