public class Domain1 {
//id
public Long id;
//资源编码
private String resCode;
//重量
private Double weight;
//投放日期
private Date putDate;
//是否可使用银票支付
private Boolean flagYinpiao;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getResCode() {
return resCode;
}
public void setResCode(String resCode) {
this.resCode = resCode;
}
public Double getWeight() {
return weight;
}
public void setWeight(Double weight) {
this.weight = weight;
}
public Date getPutDate() {
return putDate;
}
public void setPutDate(Date putDate) {
this.putDate = putDate;
}
public Boolean getFlagYinpiao() {
return flagYinpiao;
}
public void setFlagYinpiao(Boolean flagYinpiao) {
this.flagYinpiao = flagYinpiao;
}
}
public class Domain2 {
//id
public Long id2;
//资源编码
private String resCode2;
//重量
private Double weight2;
//投放日期
private Date putDate2;
//是否可使用银票支付
private Boolean flagYinpiao2;
public Long getId2() {
return id2;
}
public void setId2(Long id2) {
this.id2 = id2;
}
public String getResCode2() {
return resCode2;
}
public void setResCode2(String resCode2) {
this.resCode2 = resCode2;
}
public Double getWeight2() {
return weight2;
}
public void setWeight2(Double weight2) {
this.weight2 = weight2;
}
public Date getPutDate2() {
return putDate2;
}
public void setPutDate2(Date putDate2) {
this.putDate2 = putDate2;
}
public Boolean getFlagYinpiao2() {
return flagYinpiao2;
}
public void setFlagYinpiao2(Boolean flagYinpiao2) {
this.flagYinpiao2 = flagYinpiao2;
}
}
domain1里有5个对象,类型都不同,把domain1的数据拿到,赋给domain2,这5字段意义对应,但是字段名称不一样。这只是一个例子,我两个对象,都有一百多个属性,不能一个一个写。怎么通过反射把domain1每个字段的值赋给domain2,映射关系用配置文件写