@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 {