我想复制我的对象Kunde
,它与我的对象存在双向单对多关系Ansprechpartner
,而不需要递归。
复制功能Kunde
public void Copy(Kunde another) {
this.m_sKunde_nr = another.getKunde_nr();
this.m_sMdkz = another.getMdkz();
this.m_sName = another.getName();
this.m_sStrasse = another.getStrasse();
this.m_sPlz = another.getPlz();
this.m_sOrt = another.getOrt();
this.m_sTelnr = another.getTelnr();
this.m_sEmail_auftrag = another.getEmail_auftrag();
this.m_sEmail_allgemein = another.getEmail_allgemein();
this.m_dbLng = another.getLng();
this.m_dbLat = another.getLat();
for(Ansprechpartner a : another.getAnsprechpartner()) {
this.m_lAnsprechpartner.add(new Ansprechpartner());
this.m_lAnsprechpartner.get(this.m_lAnsprechpartner.size()-1).Copy(a);
}
}
复制功能Ansprechpartner
public void Copy(Ansprechpartner another) {
this.m_nAnsprechpartner_nr = another.getAnsprechpartner_nr();
this.m_sMdkz = another.getMdkz();
this.m_sName = another.getName();
this.m_sTelnr = another.getTelnr();
this.m_sEmail = another.getEmail();
this.m_sVerantwortlichkeit = another.getVerantwortlichkeit();
this.m_kunde = new Kunde();
this.m_kunde.Copy(another.getKunde());
}
有没有办法在没有 StackOverFlow 的情况下做到这一点?