<?xml version="1.0"?> <Results xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Code>0</Code> <Message></Message> <Data xsi:type="BlcInOutStoreResponse"> <InOutStoreHead> <oid>1</oid> <sasStockPreentNo>1</sasStockPreentNo> <sasStockNo>1</sasStockNo> <chgTmsCnt>1</chgTmsCnt> </InOutStoreHead> <InOutStoreList> <headOid>1</headOid> <sasStockSeqno>1</sasStockSeqno> <chgTmsCnt>1</chgTmsCnt> <gdsMtno>1</gdsMtno> </InOutStoreList> <InOutStorePassPortList> <PassportNo>1</PassportNo> </InOutStorePassPortList> </Data> </Results>根据以上数据创建相应的java类
时间: 2023-07-09 16:08:18 浏览: 85
cxf.apache.org/schemas/(jaxrs.xsd、jaxrs.xsd、core.xsd)文件下载
可以使用以下代码创建对应的Java类:
```java
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlRootElement(name = "Results")
@XmlType(propOrder = {"code", "message", "data"})
public class BlcInOutStoreResponse {
private int code;
private String message;
private InOutStoreData data;
public BlcInOutStoreResponse() {}
public int getCode() {
return code;
}
@XmlElement(name = "Code")
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
@XmlElement(name = "Message")
public void setMessage(String message) {
this.message = message;
}
public InOutStoreData getData() {
return data;
}
@XmlElement(name = "Data")
public void setData(InOutStoreData data) {
this.data = data;
}
@Override
public String toString() {
return "BlcInOutStoreResponse{" +
"code=" + code +
", message='" + message + '\'' +
", data=" + data +
'}';
}
}
@XmlRootElement(name = "Data")
@XmlType(propOrder = {"inOutStoreHead", "inOutStoreList", "inOutStorePassPortList"})
class InOutStoreData {
private InOutStoreHead inOutStoreHead;
private InOutStoreList inOutStoreList;
private InOutStorePassPortList inOutStorePassPortList;
public InOutStoreHead getInOutStoreHead() {
return inOutStoreHead;
}
@XmlElement(name = "InOutStoreHead")
public void setInOutStoreHead(InOutStoreHead inOutStoreHead) {
this.inOutStoreHead = inOutStoreHead;
}
public InOutStoreList getInOutStoreList() {
return inOutStoreList;
}
@XmlElement(name = "InOutStoreList")
public void setInOutStoreList(InOutStoreList inOutStoreList) {
this.inOutStoreList = inOutStoreList;
}
public InOutStorePassPortList getInOutStorePassPortList() {
return inOutStorePassPortList;
}
@XmlElement(name = "InOutStorePassPortList")
public void setInOutStorePassPortList(InOutStorePassPortList inOutStorePassPortList) {
this.inOutStorePassPortList = inOutStorePassPortList;
}
@Override
public String toString() {
return "InOutStoreData{" +
"inOutStoreHead=" + inOutStoreHead +
", inOutStoreList=" + inOutStoreList +
", inOutStorePassPortList=" + inOutStorePassPortList +
'}';
}
}
@XmlRootElement(name = "InOutStoreHead")
@XmlType(propOrder = {"oid", "sasStockPreentNo", "sasStockNo", "chgTmsCnt"})
class InOutStoreHead {
private int oid;
private int sasStockPreentNo;
private int sasStockNo;
private int chgTmsCnt;
public int getOid() {
return oid;
}
@XmlElement(name = "oid")
public void setOid(int oid) {
this.oid = oid;
}
public int getSasStockPreentNo() {
return sasStockPreentNo;
}
@XmlElement(name = "sasStockPreentNo")
public void setSasStockPreentNo(int sasStockPreentNo) {
this.sasStockPreentNo = sasStockPreentNo;
}
public int getSasStockNo() {
return sasStockNo;
}
@XmlElement(name = "sasStockNo")
public void setSasStockNo(int sasStockNo) {
this.sasStockNo = sasStockNo;
}
public int getChgTmsCnt() {
return chgTmsCnt;
}
@XmlElement(name = "chgTmsCnt")
public void setChgTmsCnt(int chgTmsCnt) {
this.chgTmsCnt = chgTmsCnt;
}
@Override
public String toString() {
return "InOutStoreHead{" +
"oid=" + oid +
", sasStockPreentNo=" + sasStockPreentNo +
", sasStockNo=" + sasStockNo +
", chgTmsCnt=" + chgTmsCnt +
'}';
}
}
@XmlRootElement(name = "InOutStoreList")
@XmlType(propOrder = {"headOid", "sasStockSeqno", "chgTmsCnt", "gdsMtno"})
class InOutStoreList {
private int headOid;
private int sasStockSeqno;
private int chgTmsCnt;
private int gdsMtno;
public int getHeadOid() {
return headOid;
}
@XmlElement(name = "headOid")
public void setHeadOid(int headOid) {
this.headOid = headOid;
}
public int getSasStockSeqno() {
return sasStockSeqno;
}
@XmlElement(name = "sasStockSeqno")
public void setSasStockSeqno(int sasStockSeqno) {
this.sasStockSeqno = sasStockSeqno;
}
public int getChgTmsCnt() {
return chgTmsCnt;
}
@XmlElement(name = "chgTmsCnt")
public void setChgTmsCnt(int chgTmsCnt) {
this.chgTmsCnt = chgTmsCnt;
}
public int getGdsMtno() {
return gdsMtno;
}
@XmlElement(name = "gdsMtno")
public void setGdsMtno(int gdsMtno) {
this.gdsMtno = gdsMtno;
}
@Override
public String toString() {
return "InOutStoreList{" +
"headOid=" + headOid +
", sasStockSeqno=" + sasStockSeqno +
", chgTmsCnt=" + chgTmsCnt +
", gdsMtno=" + gdsMtno +
'}';
}
}
@XmlRootElement(name = "InOutStorePassPortList")
@XmlType(propOrder = {"passportNo"})
class InOutStorePassPortList {
private int passportNo;
public int getPassportNo() {
return passportNo;
}
@XmlElement(name = "PassportNo")
public void setPassportNo(int passportNo) {
this.passportNo = passportNo;
}
@Override
public String toString() {
return "InOutStorePassPortList{" +
"passportNo=" + passportNo +
'}';
}
}
```
这个类中包含了所有的数据字段,以及对应的getter和setter方法,用于将XML数据转换为Java对象。在这个类中,我们使用了JAXB(Java Architecture for XML Binding)来实现XML数据和Java对象之间的转换。
阅读全文