Class CompositeDataSupport
- All Implemented Interfaces:
Serializable
,CompositeData
CompositeDataSupport
class is the open data class which
implements the CompositeData
interface.- Since:
- 1.5
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCompositeDataSupport
(CompositeType compositeType, String[] itemNames, Object[] itemValues) Constructs aCompositeDataSupport
instance with the specifiedcompositeType
, whose item values are specified byitemValues[]
, in the same order as initemNames[]
.CompositeDataSupport
(CompositeType compositeType, Map<String, ?> items) Constructs aCompositeDataSupport
instance with the specifiedcompositeType
, whose item names and corresponding values are given by the mappings in the mapitems
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(String key) Returnstrue
if and only if thisCompositeData
instance contains an item whose name iskey
.boolean
containsValue
(Object value) Returnstrue
if and only if thisCompositeData
instance contains an item whose value isvalue
.boolean
Compares the specified obj parameter with thisCompositeDataSupport
instance for equality.Returns the value of the item whose name iskey
.Object[]
Returns an array of the values of the items whose names are specified bykeys
, in the same order askeys
.Returns the composite type of this composite data instance.int
hashCode()
Returns the hash code value for thisCompositeDataSupport
instance.toString()
Returns a string representation of thisCompositeDataSupport
instance.Collection
<?> values()
Returns an unmodifiable Collection view of the item values contained in thisCompositeData
instance.
-
Constructor Details
-
CompositeDataSupport
public CompositeDataSupport(CompositeType compositeType, String[] itemNames, Object[] itemValues) throws OpenDataException Constructs a
CompositeDataSupport
instance with the specifiedcompositeType
, whose item values are specified byitemValues[]
, in the same order as initemNames[]
. As aCompositeType
does not specify any order on its items, theitemNames[]
parameter is used to specify the order in which the values are given initemValues[]
. The items contained in thisCompositeDataSupport
instance are internally stored in aTreeMap
, thus sorted in ascending lexicographic order of their names, for faster retrieval of individual item values.The constructor checks that all the constraints listed below for each parameter are satisfied, and throws the appropriate exception if they are not.
- Parameters:
compositeType
- the composite type of this composite data instance; must not be null.itemNames
-itemNames
must list, in any order, all the item names defined incompositeType
; the order in which the names are listed, is used to match values initemValues[]
; must not be null or empty.itemValues
- the values of the items, listed in the same order as their respective names initemNames
; each item value can be null, but if it is non-null it must be a valid value for the open type defined incompositeType
for the corresponding item; must be of the same size asitemNames
; must not be null or empty.- Throws:
IllegalArgumentException
-compositeType
is null, oritemNames[]
oritemValues[]
is null or empty, or one of the elements initemNames[]
is a null or empty string, oritemNames[]
anditemValues[]
are not of the same size.OpenDataException
-itemNames[]
oritemValues[]
's size differs from the number of items defined incompositeType
, or one of the elements initemNames[]
does not exist as an item name defined incompositeType
, or one of the elements initemValues[]
is not a valid value for the corresponding item as defined incompositeType
.
-
CompositeDataSupport
public CompositeDataSupport(CompositeType compositeType, Map<String, ?> items) throws OpenDataExceptionConstructs a
CompositeDataSupport
instance with the specifiedcompositeType
, whose item names and corresponding values are given by the mappings in the mapitems
. This constructor converts the keys to a string array and the values to an object array and callsCompositeDataSupport(javax.management.openmbean.CompositeType, java.lang.String[], java.lang.Object[])
.- Parameters:
compositeType
- the composite type of this composite data instance; must not be null.items
- the mappings of all the item names to their values;items
must contain all the item names defined incompositeType
; must not be null or empty.- Throws:
IllegalArgumentException
-compositeType
is null, oritems
is null or empty, or one of the keys initems
is a null or empty string.OpenDataException
-items
' size differs from the number of items defined incompositeType
, or one of the keys initems
does not exist as an item name defined incompositeType
, or one of the values initems
is not a valid value for the corresponding item as defined incompositeType
.ArrayStoreException
- one or more keys initems
is not of the classjava.lang.String
.
-
-
Method Details
-
getCompositeType
Returns the composite type of this composite data instance.- Specified by:
-