我想为Test
该类实现 JAXB,我发现如果变量是final
,是否无法注入 JAXB?XmlAdapter
在这种情况下会有所帮助吗?
public class Test implements Serializable {
private final int limit;
private Map<String, Object> results;
private final Sub sub;
@XmlElementWrapper(name = "item") //tried with this also,but not successfull
@XmlAnyElement
private final List<Item> item;
public Test(final Sub sub, final List<Item> item, final int limit) {
this(pattern, results, 0, limit, offset);
}
}
public class Item implements Serializable {
private Base base;// Interface
public Item(final Base base) {
this.base = base;
}
}
private final List<Item> item;
是迭代Item
类,它也有一个接口,Base
如果我想实现xmlAdapter
我需要这样做吗?Item
Test