United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6392303 : CompositeDataView.toCompositeData should have CompositeType parameter

Details
Type:
Enhancement
Submit Date:
2006-03-01
Status:
Resolved
Updated Date:
2010-07-29
Project Name:
JDK
Resolved Date:
2006-03-23
Component:
core-svc
OS:
generic
Sub-Component:
javax.management
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports

Sub Tasks

Description
The CompositeDataView interface allows you to specify explicitly how your custom type will be converted into a CompositeData when mapped inside the MXBean framework.  But in general the CompositeType of this CompositeData is determined by the framework.  Supplying a CompositeData with a different CompositeType may fail.

For example, suppose your MXBean references the type Map<String,MyCustomType>.  This will be mapped into a TabularType with items "key" and "value".  The "value" item will have a CompositeType determined by the framework; call it ct.  If MyCustomType implements CompositeDataView, then its toCompositeData must return a value where compositeData.getCompositeType() equals ct.  Otherwise, the attempt to construct the TabularData will fail because of the type mismatch.  And it is nontrivial to figure out what the require CompositeType looks like.

The proposed solution is simply to change the signature of CompositeDataView.toCompositeData from:
    CompositeData toCompositeData()
to
    CompositeData toCompositeData(CompositeType ct).

                                    

Comments
EVALUATION

Trivial change.  The point where the framework calls toCompositeData already has the required CompositeType available.
                                     
2006-03-01



Hardware and Software, Engineered to Work Together