java jaxb解析xml_JAXB解析xml

packagecom.jaxb;importjava.util.Date;importjavax.xml.bind.annotation.XmlAccessType;importjavax.xml.bind.annotation.XmlAccessorType;importjavax.xml.bind.annotation.XmlElement;/***

 
 

* If you annotate your Artifact class with the annotation:

* @XmlAccessorType(XmlAccessType.FIELD)

* then you do not need to annotate the fields with @XmlElement and the

* setter/getter methods will be ignored.

*

*

*@authorUser*/@XmlAccessorType(XmlAccessType.FIELD)//用了这个之后就会自动忽略setter/getter方法。不用这个就需要去掉注解,需要保证属性名和xml里的表签名一致

public classTestOrg {

@XmlElement(name= "org_id")privateLong orgId;

@XmlElement(name= "parent_id")privateLong parentId;

@XmlElement(name= "org_name")privateString orgName;

@XmlElement(name= "org_code")privateString orgCode;

@XmlElement(name= "org_type")privateString orgType;

@XmlElement(name= "start_d")privateDate startDate;

@XmlElement(name= "end_d")privateDate endDate;

@XmlElement(name= "attribute1")privateString attribute;

@XmlElement(name= "insert_t")privateDate insertTime;publicLong getOrgId() {returnorgId;

}public voidsetOrgId(Long orgId) {this.orgId =orgId;

}publicLong getParentId() {returnparentId;

}public voidsetParentId(Long parentId) {this.parentId =parentId;

}publicString getOrgName() {returnorgName;

}public voidsetOrgName(String orgName) {this.orgName =orgName;

}publicString getOrgCode() {returnorgCode;

}public voidsetOrgCode(String orgCode) {this.orgCode =orgCode;

}publicString getOrgType() {returnorgType;

}public voidsetOrgType(String orgType) {this.orgType =orgType;

}publicDate getStartDate() {returnstartDate;

}public voidsetStartDate(Date startDate) {this.startDate =startDate;

}publicDate getEndDate() {returnendDate;

}public voidsetEndDate(Date endDate) {this.endDate =endDate;

}publicString getAttribute() {returnattribute;

}public voidsetAttribute(String attribute) {this.attribute =attribute;

}publicDate getInsertTime() {returninsertTime;

}public voidsetInsertTime(Date insertTime) {this.insertTime =insertTime;

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值