]> git.mxchange.org Git - jcore.git/commitdiff
added copyAll()
authorRoland Haeder <roland@mxchange.org>
Wed, 23 Sep 2015 10:37:21 +0000 (12:37 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 23 Sep 2015 10:37:21 +0000 (12:37 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/jcore/model/contact/BaseContact.java
src/org/mxchange/jcore/model/contact/Contact.java

index b41332ecbaa9b6400e263a3f41c2b2bf27c8da00..7ec512f003634bd1a53d354daf6b17deb4067a7d 100644 (file)
@@ -203,6 +203,30 @@ public abstract class BaseContact implements Contact, Comparable<Contact> {
                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
         *
index 8cbc93db20a5f289d7dadead864562f4d9c3551e..19a5bbd0a8c3f7c5b109ed9650a97aaae5a15e26 100644 (file)
@@ -27,6 +27,14 @@ import org.mxchange.jcore.model.contact.gender.Gender;
  * @author Roland Haeder<roland@mxchange.org>
  */
 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