51 * @return the type of this CompositeData. |
52 * @return the type of this CompositeData. |
52 */ |
53 */ |
53 public CompositeType getCompositeType(); |
54 public CompositeType getCompositeType(); |
54 |
55 |
55 /** |
56 /** |
56 * Returns the value of the item whose name is <tt>key</tt>. |
57 * Returns the value of the item whose name is {@code key}. |
57 * |
58 * |
58 * @param key the name of the item. |
59 * @param key the name of the item. |
59 * |
60 * |
60 * @return the value associated with this key. |
61 * @return the value associated with this key. |
61 * |
62 * |
62 * @throws IllegalArgumentException if <tt>key</tt> is a null or empty String. |
63 * @throws IllegalArgumentException if {@code key} is a null or empty String. |
63 * |
64 * |
64 * @throws InvalidKeyException if <tt>key</tt> is not an existing item name for this <tt>CompositeData</tt> instance. |
65 * @throws InvalidKeyException if {@code key} is not an |
|
66 * existing item name for this {@code CompositeData} instance. |
65 */ |
67 */ |
66 public Object get(String key) ; |
68 public Object get(String key) ; |
67 |
69 |
68 /** |
70 /** |
69 * 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>. |
71 * Returns an array of the values of the items whose names |
|
72 * are specified by {@code keys}, in the same order as {@code keys}. |
70 * |
73 * |
71 * @param keys the names of the items. |
74 * @param keys the names of the items. |
72 * |
75 * |
73 * @return the values corresponding to the keys. |
76 * @return the values corresponding to the keys. |
74 * |
77 * |
75 * @throws IllegalArgumentException if an element in <tt>keys</tt> is a null or empty String. |
78 * @throws IllegalArgumentException if an element in {@code keys} is a null or empty String. |
76 * |
79 * |
77 * @throws InvalidKeyException if an element in <tt>keys</tt> is not an existing item name for this <tt>CompositeData</tt> instance. |
80 * @throws InvalidKeyException if an element in {@code keys} |
|
81 * is not an existing item name for this {@code CompositeData} instance. |
78 */ |
82 */ |
79 public Object[] getAll(String[] keys) ; |
83 public Object[] getAll(String[] keys) ; |
80 |
84 |
81 /** |
85 /** |
82 * Returns <tt>true</tt> if and only if this <tt>CompositeData</tt> instance contains |
86 * Returns {@code true} if and only if this {@code CompositeData} instance contains |
83 * an item whose name is <tt>key</tt>. |
87 * an item whose name is {@code key}. |
84 * If <tt>key</tt> is a null or empty String, this method simply returns false. |
88 * If {@code key} is a null or empty String, this method simply returns false. |
85 * |
89 * |
86 * @param key the key to be tested. |
90 * @param key the key to be tested. |
87 * |
91 * |
88 * @return true if this <tt>CompositeData</tt> contains the key. |
92 * @return true if this {@code CompositeData} contains the key. |
89 */ |
93 */ |
90 public boolean containsKey(String key) ; |
94 public boolean containsKey(String key) ; |
91 |
95 |
92 /** |
96 /** |
93 * Returns <tt>true</tt> if and only if this <tt>CompositeData</tt> instance contains an item |
97 * Returns {@code true} if and only if this {@code CompositeData} instance contains an item |
94 * whose value is <tt>value</tt>. |
98 * whose value is {@code value}. |
95 * |
99 * |
96 * @param value the value to be tested. |
100 * @param value the value to be tested. |
97 * |
101 * |
98 * @return true if this <tt>CompositeData</tt> contains the value. |
102 * @return true if this {@code CompositeData} contains the value. |
99 */ |
103 */ |
100 public boolean containsValue(Object value) ; |
104 public boolean containsValue(Object value) ; |
101 |
105 |
102 /** |
106 /** |
103 * Returns an unmodifiable Collection view of the item values contained in this <tt>CompositeData</tt> instance. |
107 * Returns an unmodifiable Collection view of the item values |
104 * The returned collection's iterator will return the values in the ascending lexicographic order of the corresponding |
108 * contained in this {@code CompositeData} instance. |
|
109 * The returned collection's iterator will return the values |
|
110 * in the ascending lexicographic order of the corresponding |
105 * item names. |
111 * item names. |
106 * |
112 * |
107 * @return the values. |
113 * @return the values. |
108 */ |
114 */ |
109 public Collection<?> values() ; |
115 public Collection<?> values() ; |
110 |
116 |
111 /** |
117 /** |
112 * Compares the specified <var>obj</var> parameter with this |
118 * Compares the specified <var>obj</var> parameter with this |
113 * <code>CompositeData</code> instance for equality. |
119 * {@code CompositeData} instance for equality. |
114 * <p> |
120 * <p> |
115 * Returns <tt>true</tt> if and only if all of the following statements are true: |
121 * Returns {@code true} if and only if all of the following statements are true: |
116 * <ul> |
122 * <ul> |
117 * <li><var>obj</var> is non null,</li> |
123 * <li><var>obj</var> is non null,</li> |
118 * <li><var>obj</var> also implements the <code>CompositeData</code> interface,</li> |
124 * <li><var>obj</var> also implements the {@code CompositeData} interface,</li> |
119 * <li>their composite types are equal</li> |
125 * <li>their composite types are equal</li> |
120 * <li>their contents, i.e. (name, value) pairs are equal. If a value contained in |
126 * <li>their contents, i.e. (name, value) pairs are equal. If a value contained in |
121 * the content is an array, the value comparison is done as if by calling |
127 * the content is an array, the value comparison is done as if by calling |
122 * the {@link java.util.Arrays#deepEquals(Object[], Object[]) deepEquals} method |
128 * the {@link java.util.Arrays#deepEquals(Object[], Object[]) deepEquals} method |
123 * for arrays of object reference types or the appropriate overloading of |
129 * for arrays of object reference types or the appropriate overloading of |
124 * {@code Arrays.equals(e1,e2)} for arrays of primitive types</li> |
130 * {@code Arrays.equals(e1,e2)} for arrays of primitive types</li> |
125 * </ul> |
131 * </ul> |
126 * <p> |
132 * <p> |
127 * This ensures that this <tt>equals</tt> method works properly for |
133 * This ensures that this {@code equals} method works properly for |
128 * <var>obj</var> parameters which are different implementations of the |
134 * <var>obj</var> parameters which are different implementations of the |
129 * <code>CompositeData</code> interface, with the restrictions mentioned in the |
135 * {@code CompositeData} interface, with the restrictions mentioned in the |
130 * {@link java.util.Collection#equals(Object) equals} |
136 * {@link java.util.Collection#equals(Object) equals} |
131 * method of the <tt>java.util.Collection</tt> interface. |
137 * method of the {@code java.util.Collection} interface. |
132 * |
138 * |
133 * @param obj the object to be compared for equality with this |
139 * @param obj the object to be compared for equality with this |
134 * <code>CompositeData</code> instance. |
140 * {@code CompositeData} instance. |
135 * @return <code>true</code> if the specified object is equal to this |
141 * @return {@code true} if the specified object is equal to this |
136 * <code>CompositeData</code> instance. |
142 * {@code CompositeData} instance. |
137 */ |
143 */ |
138 public boolean equals(Object obj) ; |
144 public boolean equals(Object obj) ; |
139 |
145 |
140 /** |
146 /** |
141 * Returns the hash code value for this <code>CompositeData</code> instance. |
147 * Returns the hash code value for this {@code CompositeData} instance. |
142 * <p> |
148 * <p> |
143 * The hash code of a <code>CompositeData</code> instance is the sum of the hash codes |
149 * The hash code of a {@code CompositeData} instance is the sum of the hash codes |
144 * of all elements of information used in <code>equals</code> comparisons |
150 * of all elements of information used in {@code equals} comparisons |
145 * (ie: its <i>composite type</i> and all the item values). |
151 * (ie: its <i>composite type</i> and all the item values). |
146 * <p> |
152 * <p> |
147 * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code> |
153 * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()} |
148 * for any two <code>CompositeData</code> instances <code>t1</code> and <code>t2</code>, |
154 * for any two {@code CompositeData} instances {@code t1} and {@code t2}, |
149 * as required by the general contract of the method |
155 * as required by the general contract of the method |
150 * {@link Object#hashCode() Object.hashCode()}. |
156 * {@link Object#hashCode() Object.hashCode()}. |
151 * <p> |
157 * <p> |
152 * Each item value's hash code is added to the returned hash code. |
158 * Each item value's hash code is added to the returned hash code. |
153 * If an item value is an array, |
159 * If an item value is an array, |
154 * its hash code is obtained as if by calling the |
160 * its hash code is obtained as if by calling the |
155 * {@link java.util.Arrays#deepHashCode(Object[]) deepHashCode} method |
161 * {@link java.util.Arrays#deepHashCode(Object[]) deepHashCode} method |
156 * for arrays of object reference types or the appropriate overloading |
162 * for arrays of object reference types or the appropriate overloading |
157 * of {@code Arrays.hashCode(e)} for arrays of primitive types. |
163 * of {@code Arrays.hashCode(e)} for arrays of primitive types. |
158 * |
164 * |
159 * @return the hash code value for this <code>CompositeData</code> instance |
165 * @return the hash code value for this {@code CompositeData} instance |
160 */ |
166 */ |
161 public int hashCode() ; |
167 public int hashCode() ; |
162 |
168 |
163 /** |
169 /** |
164 * Returns a string representation of this <code>CompositeData</code> instance. |
170 * Returns a string representation of this {@code CompositeData} instance. |
165 * <p> |
171 * <p> |
166 * The string representation consists of the name of the implementing class, |
172 * The string representation consists of the name of the implementing class, |
167 * the string representation of the composite type of this instance, and the string representation of the contents |
173 * the string representation of the composite type of this instance, |
|
174 * and the string representation of the contents |
168 * (ie list the itemName=itemValue mappings). |
175 * (ie list the itemName=itemValue mappings). |
169 * |
176 * |
170 * @return a string representation of this <code>CompositeData</code> instance |
177 * @return a string representation of this {@code CompositeData} instance |
171 */ |
178 */ |
172 public String toString() ; |
179 public String toString() ; |
173 |
180 |
174 } |
181 } |