From: Roland Haeder Date: Wed, 23 Sep 2015 10:37:21 +0000 (+0200) Subject: added copyAll() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c78f8860898d9fc851edf4fad3e8e232e1f01e90;p=jcore.git added copyAll() Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/jcore/model/contact/BaseContact.java b/src/org/mxchange/jcore/model/contact/BaseContact.java index b41332e..7ec512f 100644 --- a/src/org/mxchange/jcore/model/contact/BaseContact.java +++ b/src/org/mxchange/jcore/model/contact/BaseContact.java @@ -203,6 +203,30 @@ public abstract class BaseContact implements Contact, Comparable { return 1; } + @Override + public void copyAll (final Contact contact) { + // Copy all: + // - base data + this.setFirstName(contact.getFirstName()); + this.setFamilyName(contact.getFamilyName()); + this.setCompanyName(contact.getCompanyName()); + this.setStreet(contact.getStreet()); + this.setZipCode(contact.getZipCode()); + this.setCity(contact.getCity()); + this.setCountryCode(contact.getCountryCode()); + + // - phone, fax, email + this.setPhoneNumber(contact.getPhoneNumber()); + this.setFaxNumber(contact.getFaxNumber()); + this.setCellphoneNumber(contact.getCellphoneNumber()); + + // - other data + this.setBirthday(contact.getBirthday()); + this.setComment(contact.getComment()); + this.setCreated(contact.getCreated()); + this.setUpdated(contact.getUpdated()); + } + /** * Check if contacts are same or throw an exception * diff --git a/src/org/mxchange/jcore/model/contact/Contact.java b/src/org/mxchange/jcore/model/contact/Contact.java index 8cbc93d..19a5bbd 100644 --- a/src/org/mxchange/jcore/model/contact/Contact.java +++ b/src/org/mxchange/jcore/model/contact/Contact.java @@ -27,6 +27,14 @@ import org.mxchange.jcore.model.contact.gender.Gender; * @author Roland Haeder */ public interface Contact extends Serializable { + + /** + * Copies all attributes from other contact object to this + * + * @param contact Source instance + */ + public void copyAll (final Contact contact); + /** * Id number * @return the contactId