Reputation: 1105
I need to define and implement an MXBean interface. One of the methods would return a Collection. This seems to be not supported by MXBeans. I get an OpenDataException saying "Cannot convert type: java.util.Collection". If I change it to List or Set then it works.
I have not found any documentation saying that Collections are not supported and this is why I am asking you experts. Do I miss something ?
Upvotes: 3
Views: 2263
Reputation: 1144
The javadoc of the MXBean annotation describes in detail the mapping rules. List, Set, SortedSet are supported but not Collection.
Upvotes: 4
Reputation: 20663
Specification does not say it supports Java collections:
The following list specifies all data types that are allowed as scalars or as anydimensional arrays in open MBeans:
- java.lang.Void
- java.lang.Short
- java.lang.Boolean
- java.lang.Integer
- java.lang.Byte
- java.lang.Long
- java.lang.Character
- java.lang.Float
- java.lang.String
- java.lang.Double
- java.math.BigDecimal
- java.math.BigInteger
- java.util.Date
- javax.management.ObjectName
- javax.management.openmbean.CompositeData (interface)
- javax.management.openmbean.TabularData (interface)
You can use either arrays or TabularData.
Upvotes: 1