2010-11-09 292 views
6

我們在下面有JAXB/Java代碼。這工作得很好,直到我們將List<JQGridTO> rows更改爲List<? extends JQGridTO> rowsJAXB和包含泛型的集合

當我們作出改變,我們得到這個錯誤:

Constructor threw exception; nested exception is com.sun. xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Property rows appears in @XmlType.propOrder, but no such property exists. Maybe you meant records? this problem is related to the following location: at com.me.ui.service.JQGridJsonRoot

爲什麼我們得到這個錯誤?你不能像我們一樣使用泛型(即:指定? extends XXX)?

@XmlRootElement 
@XmlType(name = "", propOrder = { 
     "records", 
     "page", 
     "total", 
     "rows" 
}) 
public class JQGridJsonRoot { 
    int total; //total pages for the query 
    int page; //current page of the query 
    int records; //total number of records for the query 
    List<? extends JQGridTO> rows 
    ... 

回答