Using int as a type parameter for java.util.Dictionary

后端 未结 6 2147
孤独总比滥情好
孤独总比滥情好 2021-02-06 22:51

When I try to declare a Dictionary as such:

private Dictionary map;

The compiler gives me the following error:

6条回答
  •  春和景丽
    2021-02-06 23:29

    @XmlJavaTypeAdapter(value=MyAdapter.class, type=int.class)
    

    Thats the trick specify type to make it work with primitives

    In your adapter

    using the same in package-info will mean you do it globally for that package

    Found this after experimenting.

    public class MyAdapter extends XmlAdapter {
    

提交回复
热议问题