开发者

Collections via MXBeans

开发者 https://www.devze.com 2023-04-07 05:39 出处:网络
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: ja

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 th开发者_运维知识库at Collections are not supported and this is why I am asking you experts. Do I miss something ?


The javadoc of the MXBean annotation describes in detail the mapping rules. List, Set, SortedSet are supported but not Collection.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消