javax.management.openmbean

Interface CompositeData

public interface CompositeData

Provides an interface to a composite data structure, in order to aid interoperability. The composite data structure is represented by mapping field names to values.

Since: 1.5

Method Summary
booleancontainsKey(String key)
Returns true if this {@link CompositeData} instance contains the specified key.
booleancontainsValue(Object value)
Returns true if this {@link CompositeData} instance has a value equal to that supplied.
booleanequals(Object obj)
Compares the specified object with this object for equality.
Objectget(String key)
Retrieves the value for the specified key.
Object[]getAll(String[] keys)
Returns the appropriate value for each key in the given array, using the same ordering.
CompositeTypegetCompositeType()
Returns the composite type which corresponds to this instance of {@link CompositeData}.
inthashCode()
Returns the hash code of this instance.
StringtoString()
Returns a textual representation of this instance.
Collection<?>values()
Returns a read-only collection of the values associated with this instance.

Method Detail

containsKey

public boolean containsKey(String key)
Returns true if this {@link CompositeData} instance contains the specified key. This method always returns false for an input key equal to null or the empty string.

Parameters: key the key to find in the structure.

Returns: true if the key exists.

containsValue

public boolean containsValue(Object value)
Returns true if this {@link CompositeData} instance has a value equal to that supplied.

Parameters: value the value to look for.

Returns: true if the value exists.

equals

public boolean equals(Object obj)
Compares the specified object with this object for equality. The object is judged equivalent if it is non-null, and also an instance of {@link CompositeData} with the same name-value mappings and types. The two compared instances may be equivalent even if they represent different implementations of {@link CompositeData}.

Parameters: obj the object to compare for equality.

Returns: true if obj is equal to this.

get

public Object get(String key)
Retrieves the value for the specified key.

Parameters: key the key whose value should be returned.

Returns: the matching value.

Throws: IllegalArgumentException if the key is null or the empty string. InvalidKeyException if the key does not exist.

getAll

public Object[] getAll(String[] keys)
Returns the appropriate value for each key in the given array, using the same ordering.

Parameters: keys the keys whose values should be returned.

Returns: the matching values.

Throws: IllegalArgumentException if one of the keys is null or the empty string. InvalidKeyException if one of the keys does not exist.

getCompositeType

public CompositeType getCompositeType()
Returns the composite type which corresponds to this instance of {@link CompositeData}.

Returns: the composite type for this instance.

hashCode

public int hashCode()
Returns the hash code of this instance. The hash code is computed as the sum of the hash codes of all the values plus the hash code of the composite type. As equality comparisons take place using this same information, this ensures that the property, e1.equals(e2) implies e1.hashCode() == e2.hashCode(), holds for any pair of instances, e1 and e2.

Returns: the hash code of this {@link CompositeData}.

See Also: equals

toString

public String toString()
Returns a textual representation of this instance. The exact format is left up to the implementation, but it should contain the name of the implementing class, the name of the type and a mapping of the form key=value for each pair of key and value.

Returns: a {@link java.lang.String} representation of the object.

values

public Collection<?> values()
Returns a read-only collection of the values associated with this instance. The values are sorted using the lexicographic ordering of the corresponding keys.

Returns: the values of this instance.