From c78f8860898d9fc851edf4fad3e8e232e1f01e90 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 23 Sep 2015 12:37:21 +0200 Subject: [PATCH] =?utf8?q?added=20copyAll()=20Signed-off-by:Roland=20H?= =?utf8?q?=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../jcore/model/contact/BaseContact.java | 24 +++++++++++++++++++ .../mxchange/jcore/model/contact/Contact.java | 8 +++++++ 2 files changed, 32 insertions(+) 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 -- 2.39.5