1 /*
2 * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26
27 package javax.management.openmbean;
28
29
30 // java import
31 //
32
33
34 // jmx import
35 //
36
37
38 /**
39 * <p>Describes an attribute of an open MBean.</p>
40 *
41 * <p>This interface declares the same methods as the class {@link
42 * javax.management.MBeanAttributeInfo}. A class implementing this
43 * interface (typically {@link OpenMBeanAttributeInfoSupport}) should
44 * extend {@link javax.management.MBeanAttributeInfo}.</p>
45 *
46 *
47 * @since 1.5
48 */
49 public interface OpenMBeanAttributeInfo extends OpenMBeanParameterInfo {
50
51
52 // Re-declares the methods that are in class MBeanAttributeInfo of JMX 1.0
53 // (these will be removed when MBeanAttributeInfo is made a parent interface of this interface)
54
55 /**
56 * Returns <tt>true</tt> if the attribute described by this <tt>OpenMBeanAttributeInfo</tt> instance is readable,
57 * <tt>false</tt> otherwise.
58 *
59 * @return true if the attribute is readable.
60 */
61 public boolean isReadable() ;
62
63 /**
64 * Returns <tt>true</tt> if the attribute described by this <tt>OpenMBeanAttributeInfo</tt> instance is writable,
65 * <tt>false</tt> otherwise.
66 *
67 * @return true if the attribute is writable.
68 */
69 public boolean isWritable() ;
70
71 /**
72 * Returns <tt>true</tt> if the attribute described by this <tt>OpenMBeanAttributeInfo</tt> instance
73 * is accessed through a <tt>is<i>XXX</i></tt> getter (applies only to <tt>boolean</tt> and <tt>Boolean</tt> values),
74 * <tt>false</tt> otherwise.
75 *
76 * @return true if the attribute is accessed through <tt>is<i>XXX</i></tt>.
77 */
78 public boolean isIs() ;
79
80
81 // commodity methods
82 //
83
84 /**
85 * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanAttributeInfo</code> instance for equality.
86 * <p>
87 * Returns <tt>true</tt> if and only if all of the following statements are true:
88 * <ul>
89 * <li><var>obj</var> is non null,</li>
90 * <li><var>obj</var> also implements the <code>OpenMBeanAttributeInfo</code> interface,</li>
91 * <li>their names are equal</li>
92 * <li>their open types are equal</li>
93 * <li>their access properties (isReadable, isWritable and isIs) are equal</li>
94 * <li>their default, min, max and legal values are equal.</li>
95 * </ul>
96 * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
97 * different implementations of the <code>OpenMBeanAttributeInfo</code> interface.
98 * <br>
99 * @param obj the object to be compared for equality with this <code>OpenMBeanAttributeInfo</code> instance;
100 *
101 * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanAttributeInfo</code> instance.
102 */
103 public boolean equals(Object obj);
104
105 /**
106 * Returns the hash code value for this <code>OpenMBeanAttributeInfo</code> instance.
107 * <p>
108 * The hash code of an <code>OpenMBeanAttributeInfo</code> instance is the sum of the hash codes
109 * of all elements of information used in <code>equals</code> comparisons
110 * (ie: its name, its <i>open type</i>, and its default, min, max and legal values).
111 * <p>
112 * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
113 * for any two <code>OpenMBeanAttributeInfo</code> instances <code>t1</code> and <code>t2</code>,
114 * as required by the general contract of the method
115 * {@link Object#hashCode() Object.hashCode()}.
116 * <p>
117 *
118 * @return the hash code value for this <code>OpenMBeanAttributeInfo</code> instance
119 */
120 public int hashCode();
121
122 /**
123 * Returns a string representation of this <code>OpenMBeanAttributeInfo</code> instance.
124 * <p>
125 * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanAttributeInfo</code>),
126 * the string representation of the name and open type of the described attribute,
127 * and the string representation of its default, min, max and legal values.
128 *
129 * @return a string representation of this <code>OpenMBeanAttributeInfo</code> instance
130 */
131 public String toString();
132
133
134 // methods specific to open MBeans are inherited from
135 // OpenMBeanParameterInfo
136 //
137
138 }