javax.management.openmbean
Class CompositeDataSupport

java.lang.Object
  extended byjavax.management.openmbean.CompositeDataSupport
All Implemented Interfaces:
CompositeData (src) , java.io.Serializable

public class CompositeDataSupport
extends java.lang.Object
implements CompositeData (src) , java.io.Serializable

An implementation of CompositeData.

See Also:
Serialized Form

Constructor Summary
CompositeDataSupport(CompositeType (src)  compositeType, java.util.Map items)
          Construct Composite Data
CompositeDataSupport(CompositeType (src)  compositeType, java.lang.String[] itemNames, java.lang.Object[] itemValues)
          Construct Composite Data
 
Method Summary
 boolean containsKey(java.lang.String key)
          Tests whether a key is part of this composite data
 boolean containsValue(java.lang.Object value)
          Tests whether a item exists with the passed value
 boolean equals(java.lang.Object obj)
          Tests whether two composite data objects are equal
 java.lang.Object get(java.lang.String key)
          Retrieve the value for the item with the passed key
 java.lang.Object[] getAll(java.lang.String[] keys)
          Returns an array of the values of the items whose names are specified by keys, in the same order as keys.
 CompositeType (src) getCompositeType()
          Retrieve the composite type for this composite data
 int hashCode()
          Returns the hash code value for this CompositeDataSupport instance.
 java.lang.String toString()
          Returns a string representation of this CompositeDataSupport instance.
 java.util.Collection values()
          The values of this composite data
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompositeDataSupport

public CompositeDataSupport(CompositeType (src)  compositeType,
                            java.lang.String[] itemNames,
                            java.lang.Object[] itemValues)
                     throws OpenDataException (src) 
Construct Composite Data

Parameters:
compositeType - the composite type of the data
itemNames - the names of the values
itemValues - the values
Throws:
java.lang.IllegalArgumentException - for a null or empty argument
OpenDataException (src) - when the items do not match the CompositeType

CompositeDataSupport

public CompositeDataSupport(CompositeType (src)  compositeType,
                            java.util.Map items)
                     throws OpenDataException (src) 
Construct Composite Data

Parameters:
compositeType - the composite type of the data
items - map of strings to values
Throws:
java.lang.IllegalArgumentException - for a null or empty argument
OpenDataException (src) - when the items do not match the CompositeType
java.lang.ArrayStoreException - when a key to the map is not a String
Method Detail

getCompositeType

public CompositeType (src)  getCompositeType()
Description copied from interface: CompositeData (src)
Retrieve the composite type for this composite data

Specified by:
getCompositeType in interface CompositeData (src)
Returns:
the composite type

get

public java.lang.Object get(java.lang.String key)
Description copied from interface: CompositeData (src)
Retrieve the value for the item with the passed key

Specified by:
get in interface CompositeData (src)
Returns:
the value

getAll

public java.lang.Object[] getAll(java.lang.String[] keys)
Returns an array of the values of the items whose names are specified by keys, in the same order as keys.

Specified by:
getAll in interface CompositeData (src)
Returns:
the array of values

containsKey

public boolean containsKey(java.lang.String key)
Description copied from interface: CompositeData (src)
Tests whether a key is part of this composite data

Specified by:
containsKey in interface CompositeData (src)
Returns:
true when the key exists, false otherwise

containsValue

public boolean containsValue(java.lang.Object value)
Description copied from interface: CompositeData (src)
Tests whether a item exists with the passed value

Specified by:
containsValue in interface CompositeData (src)
Returns:
true when the value exists, false otherwise

values

public java.util.Collection values()
Description copied from interface: CompositeData (src)
The values of this composite data

An iterator over the returned collection returns result in ascending lexicographic order

Specified by:
values in interface CompositeData (src)
Returns:
an unmodifiable Collection of the values of this CompositeType.

equals

public boolean equals(java.lang.Object obj)
Description copied from interface: CompositeData (src)
Tests whether two composite data objects are equal

The object is non-null
The object implements this interface
The composite types are equal
The values are equal

Specified by:
equals in interface CompositeData (src)

hashCode

public int hashCode()
Returns the hash code value for this CompositeDataSupport instance. The hash code of a CompositeDataSupport instance is the sum of the hash codes of all elements of information used in equals comparisons (ie: its composite type and all the item values). This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode() for any two CompositeDataSupport instances t1 and t2, as required by the general contract of the method Object.hashCode . However, note that another instance of a class implementing the CompositeData interface may be equal to this CompositeDataSupport instance as defined by equals(java.lang.Object), but may have a different hash code if it is calculated differently.

Specified by:
hashCode in interface CompositeData (src)

toString

public java.lang.String toString()
Returns a string representation of this CompositeDataSupport instance. The string representation consists of the name of this class (ie javax.management.openmbean.CompositeDataSupport), the string representation of the composite type of this instance, and the string representation of the contents (ie list the itemName=itemValue mappings).

Specified by:
toString in interface CompositeData (src)