1

用什么替换@XmlElementsSimple XML 框架中的 JAXB 注解?

@XmlElements({ 
    @XmlElement(name = "distance", type = DistanceCheck.class), 
    @XmlElement(name = "pattern", type = PatternCheck.class), 
    @XmlElement(name = "compare", type = ComparisonCheck.class),
    @XmlElement(name = "check", type = CustomCheck.class), 
    @XmlElement(name = "unique", type = UniquenessCheck.class) 
 })
4

1 回答 1

2

等效的是:

@ElementUnion({
    @Element(name="distance", type=DistanceCheck.class),
    @Element(name="pattern", type=PatternCheck.class),
    @Element(name="compare", type=ComparisonCheck.class),
    @Element(name="check", type=CustomCheck.class),
    @Element(name="unique", type=UniquenessCheck.class)
})
于 2012-08-23T18:31:02.213 回答