|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ipdr.common.CompositeData
public class CompositeData
This class represents an arbitrary collection of structured data. The data is built from the basic data types as outlined in the Java Management Extensions (JMX) 1.0 Specification Chapter 3, OpenMBeans.
A CompositeData object is self describing, utilizing a CompositeType class which describes what fields are in an object, and based on order, how they are layed out.
The structure of a given instance of the CompositeData object is determined when it is constructed. The type and object array are immutable. Entries within the object array may be overridden, but they are constrained according to the CompositeType information.
This implementation diverges from the JMX 1.0 spec in that it will allow values of fields within the object to be modified. This can simplify management of frequently constructed objects in some instance.
Field Summary | |
---|---|
protected java.lang.Object[] |
fields_
The fields within this Composite Data |
protected CompositeType |
type_
The type of this Composite Data |
Constructor Summary | |
---|---|
CompositeData(java.lang.Object[] fields,
CompositeType type)
Builds a composite type from the supplied array of objects and the type specifier. |
Method Summary | |
---|---|
protected void |
assertCompositeType(OpenType type,
java.lang.Object obj)
This method will throw an exception if the Data Object is not compatable with the Composite Type object. |
protected void |
assertObject(OpenType type,
java.lang.Object obj)
This method will throw an exception if the Data Object is not compatable with the Type object. |
protected void |
assertOpenType(OpenType type,
java.lang.Object obj)
This method will throw an exception if the Data Object is not compatable with the Type object. |
java.lang.Object |
getField(int fieldPosition)
Returns the object at the given index. |
java.lang.Object |
getField(java.lang.String fieldName)
Returns the object for the named field. |
CompositeType |
getType()
Retreives the type list which describes the layout of data for this CompositeType. |
static void |
main(java.lang.String[] args)
Simple demonstration entry point. |
void |
setField(java.lang.String fieldName,
java.lang.Object obj)
Method to set the Data object at the named field. |
java.lang.String |
toString()
Utility method for displaying types. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected CompositeType type_
protected java.lang.Object[] fields_
Constructor Detail |
---|
public CompositeData(java.lang.Object[] fields, CompositeType type) throws BadCompositeException, IPDRException
fields
- Object Arraytype
- Object of CompositeType
BadCompositeException
- when array of objects is null or the
Data and Type are not in agreement.
IPDRException
- when a IPDR functionality related exception occursMethod Detail |
---|
protected void assertObject(OpenType type, java.lang.Object obj) throws BadCompositeException, IPDRException
type
- The OpenTypeobj
- The Data Object
BadCompositeException
- when the TypeCode is not recognised
or when the Data and Type are not in agreement
IPDRException
- when a IPDR functionality related exception occursprotected void assertOpenType(OpenType type, java.lang.Object obj) throws BadCompositeException, IPDRException
type
- The OpenTypeobj
- The Data Object
BadCompositeException
- when the TypeCode is not recognised
or when the Data and Type are not in agreement
IPDRException
- when a IPDR functionality related exception occursprotected void assertCompositeType(OpenType type, java.lang.Object obj) throws BadCompositeException, IPDRException
type
- The OpenTypeobj
- The Data Object
BadCompositeException
- when the TypeCode is not recognised
or when the Data and Type are not in agreement
IPDRException
- when a IPDR functionality related exception occurspublic CompositeType getType()
public java.lang.Object getField(java.lang.String fieldName) throws BadCompositeException
fieldName
- The field name
BadCompositeException
- when the field does not exist.public java.lang.Object getField(int fieldPosition)
fieldPosition
- The field's position
public void setField(java.lang.String fieldName, java.lang.Object obj) throws BadCompositeException, IPDRException
fieldName
- The field nameobj
- The new field value
BadCompositeException
- when the field does not exist.
IPDRException
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |