0
웹 서비스를 만들기 위해 Java/Eclipse/Spring을 사용하고 있습니다. Web Services (Request, Response, etc.)를위한 Java 클래스 용 구조를 가진 XSD 파일을 작성하고 있습니다. XSD 파일에서 "Generate Jaxb Classes"옵션을 사용하여 Java 클래스를 생성했습니다. int, string, long 등과 같은 데이터 유형에는 문제가 없지만 내 속성이 객체의 ArrayList 일 때 생성 된 Java 클래스에는 속성의 "SET"메서드가 없습니다. "GET"메소드 만 있습니다.XSD 파일로 객체의 ArrayList를 매핑하기
XSD 파일 :
<element name="GetPrizesAndCatalogsResponse">
<complexType>
<sequence>
<element name="answerCode" type="int" />
<element name="prizes" type="tns:SW_Prize" maxOccurs="unbounded"></element>
<element name="prizesCatalog" type="tns:SW_Catalog" maxOccurs="unbounded"></element>
<element name="pagination" type="tns:SW_Pagination"></element>
</sequence>
</complexType>
</element>
자바 클래스 :
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"answerCode",
"prizes",
"prizesCatalog",
"pagination"
})
@XmlRootElement(name = "GetPrizesAndCatalogsResponse")
public class GetPrizesAndCatalogsResponse {
protected int answerCode;
@XmlElement(required = true)
protected List<SWPrize> prizes;
@XmlElement(required = true)
protected List<SWCatalog> prizesCatalog;
@XmlElement(required = true)
protected SWPagination pagination;
/**
* Obtiene el valor de la propiedad answerCode.
*
*/
public int getAnswerCode() {
return answerCode;
}
/**
* Define el valor de la propiedad answerCode.
*
*/
public void setAnswerCode(int value) {
this.answerCode = value;
}
/**
* Gets the value of the prizes property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the prizes property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPrizes().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SWPrize }
*
*
*/
public List<SWPrize> getPrizes() {
if (prizes == null) {
prizes = new ArrayList<SWPrize>();
}
return this.prizes;
}
/**
* Gets the value of the prizesCatalog property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the prizesCatalog property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPrizesCatalog().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SWCatalog }
*
*
*/
public List<SWCatalog> getPrizesCatalog() {
if (prizesCatalog == null) {
prizesCatalog = new ArrayList<SWCatalog>();
}
return this.prizesCatalog;
}
/**
* Obtiene el valor de la propiedad pagination.
*
* @return
* possible object is
* {@link SWPagination }
*
*/
public SWPagination getPagination() {
return pagination;
}
/**
* Define el valor de la propiedad pagination.
*
* @param value
* allowed object is
* {@link SWPagination }
*
*/
public void setPagination(SWPagination value) {
this.pagination = value;
}
}
는 XSD 파일의 나의 정의는 정확
이
은 예입니다? XML에 다른 태그를 추가해야합니까?
아무도 나를 도울 수 있습니까? 나는 길을 잃었다. –