KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > management > openmbean > CompositeData


1 /*
2  * @(#)CompositeData.java 3.19 04/02/10
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8
9 package javax.management.openmbean;
10
11
12 // java import
13
//
14
import java.io.Serializable JavaDoc;
15 import java.util.Collection JavaDoc;
16 import java.util.Map JavaDoc;
17
18 // jmx import
19
//
20

21
22 /**
23  * The <tt>CompositeData</tt> interface specifies the behavior of a specific type of complex <i>open data</i> objects
24  * which represent <i>composite data</i> structures.
25  *
26  * @version 3.19 04/02/10
27  * @author Sun Microsystems, Inc.
28  *
29  * @since 1.5
30  * @since.unbundled JMX 1.1
31  */

32 public interface CompositeData {
33
34
35     /**
36      * Returns the <i>composite type </i> of this <i>composite data</i> instance.
37      *
38      * @return the type of this CompositeData.
39      */

40     public CompositeType JavaDoc getCompositeType();
41
42     /**
43      * Returns the value of the item whose name is <tt>key</tt>.
44      *
45      * @param key the name of the item.
46      *
47      * @return the value associated with this key.
48      *
49      * @throws IllegalArgumentException if <tt>key</tt> is a null or empty String.
50      *
51      * @throws InvalidKeyException if <tt>key</tt> is not an existing item name for this <tt>CompositeData</tt> instance.
52      */

53     public Object JavaDoc get(String JavaDoc key) ;
54
55     /**
56      * Returns an array of the values of the items whose names are specified by <tt>keys</tt>, in the same order as <tt>keys</tt>.
57      *
58      * @param keys the names of the items.
59      *
60      * @return the values corresponding to the keys.
61      *
62      * @throws IllegalArgumentException if an element in <tt>keys</tt> is a null or empty String.
63      *
64      * @throws InvalidKeyException if an element in <tt>keys</tt> is not an existing item name for this <tt>CompositeData</tt> instance.
65      */

66     public Object JavaDoc[] getAll(String JavaDoc[] keys) ;
67
68     /**
69      * Returns <tt>true</tt> if and only if this <tt>CompositeData</tt> instance contains
70      * an item whose name is <tt>key</tt>.
71      * If <tt>key</tt> is a null or empty String, this method simply returns false.
72      *
73      * @param key the key to be tested.
74      *
75      * @return true if this <tt>CompositeData</tt> contains the key.
76      */

77     public boolean containsKey(String JavaDoc key) ;
78
79     /**
80      * Returns <tt>true</tt> if and only if this <tt>CompositeData</tt> instance contains an item
81      * whose value is <tt>value</tt>.
82      *
83      * @param value the value to be tested.
84      *
85      * @return true if this <tt>CompositeData</tt> contains the value.
86      */

87     public boolean containsValue(Object JavaDoc value) ;
88
89     /**
90      * Returns an unmodifiable Collection view of the item values contained in this <tt>CompositeData</tt> instance.
91      * The returned collection's iterator will return the values in the ascending lexicographic order of the corresponding
92      * item names.
93      *
94      * @return the values.
95      */

96     public Collection JavaDoc values() ;
97
98     /**
99      * Compares the specified <var>obj</var> parameter with this <code>CompositeData</code> instance for equality.
100      * <p>
101      * Returns <tt>true</tt> if and only if all of the following statements are true:
102      * <ul>
103      * <li><var>obj</var> is non null,</li>
104      * <li><var>obj</var> also implements the <code>CompositeData</code> interface,</li>
105      * <li>their composite types are equal</li>
106      * <li>their contents (ie item values) are equal.</li>
107      * </ul>
108      * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
109      * different implementations of the <code>CompositeData</code> interface.
110      * <br>&nbsp;
111      * @param obj the object to be compared for equality with this <code>CompositeData</code> instance;
112      *
113      * @return <code>true</code> if the specified object is equal to this <code>CompositeData</code> instance.
114      */

115     public boolean equals(Object JavaDoc obj) ;
116
117     /**
118      * Returns the hash code value for this <code>CompositeData</code> instance.
119      * <p>
120      * The hash code of a <code>CompositeData</code> instance is the sum of the hash codes
121      * of all elements of information used in <code>equals</code> comparisons
122      * (ie: its <i>composite type</i> and all the item values).
123      * <p>
124      * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
125      * for any two <code>CompositeData</code> instances <code>t1</code> and <code>t2</code>,
126      * as required by the general contract of the method
127      * {@link Object#hashCode() Object.hashCode()}.
128      * <p>
129      *
130      * @return the hash code value for this <code>CompositeData</code> instance
131      */

132     public int hashCode() ;
133
134     /**
135      * Returns a string representation of this <code>CompositeData</code> instance.
136      * <p>
137      * The string representation consists of the name of the implementing class,
138      * the string representation of the composite type of this instance, and the string representation of the contents
139      * (ie list the itemName=itemValue mappings).
140      *
141      * @return a string representation of this <code>CompositeData</code> instance
142      */

143     public String JavaDoc toString() ;
144
145 }
146
Popular Tags