X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Fjcontacts%2Fmodel%2Fcontact%2FContacts.java;h=e95a4c7392a62abd0e058f0fb1b4d6d5a5a873ce;hb=7df4118c9b2349af841c0d43d96fa1400084c7d4;hp=86d67dd2f648058f24e7f5b8947c9ce9a7cd4c5c;hpb=12faad5115ebfb768e753bcfc38ac861d1d0a3bd;p=jcontacts-core.git diff --git a/src/org/mxchange/jcontacts/model/contact/Contacts.java b/src/org/mxchange/jcontacts/model/contact/Contacts.java index 86d67dd..e95a4c7 100644 --- a/src/org/mxchange/jcontacts/model/contact/Contacts.java +++ b/src/org/mxchange/jcontacts/model/contact/Contacts.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 - 2018 Free Software Foundation + * Copyright (C) 2016 - 2020 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,8 +47,6 @@ public class Contacts implements Serializable { * @param contact2 Contact instance 2 *

* @return Comparison value - *

- * @throws NullPointerException If first instance is null */ public static int compare (final Contact contact1, final Contact contact2) { // Check euqality, then at least first must be given @@ -56,11 +54,11 @@ public class Contacts implements Serializable { // Both are same return 0; } else if (null == contact1) { - // First cannot be null - throw new NullPointerException("contact1 is null"); //NOI18N + // First is null + return -1; } else if (null == contact2) { // Second is null - return -1; + return 1; } // Invoke compareTo() method @@ -73,7 +71,7 @@ public class Contacts implements Serializable { * @param sourceContact Source instance * @param targetContact Target instance */ - public static void copyAll (final Contact sourceContact, final Contact targetContact) { + public static void copyContactData (final Contact sourceContact, final Contact targetContact) { // Contact should be valid if (null == sourceContact) { // Throw NPE @@ -104,8 +102,7 @@ public class Contacts implements Serializable { // - other data targetContact.setContactBirthday(sourceContact.getContactBirthday()); targetContact.setContactComment(sourceContact.getContactComment()); - targetContact.setContactCreated(sourceContact.getContactCreated()); - targetContact.setContactUpdated(sourceContact.getContactUpdated()); + targetContact.setContactEntryUpdated(sourceContact.getContactEntryUpdated()); } /** @@ -182,7 +179,7 @@ public class Contacts implements Serializable { } } else if ((faxCountry instanceof Country) && (faxAreaCode > 0) && (faxNumber > 0)) { // Set new land-line number - DialableFaxNumber fax = new FaxNumber(faxCountry, faxAreaCode, faxNumber); + final DialableFaxNumber fax = new FaxNumber(faxCountry, faxAreaCode, faxNumber); // Set it in contact contact.setContactFaxNumber(fax); @@ -232,7 +229,7 @@ public class Contacts implements Serializable { } } else if ((phoneCountry instanceof Country) && (phoneAreaCode > 0) && (phoneNumber > 0)) { // Set new land-line number - DialableLandLineNumber landLine = new LandLineNumber(phoneCountry, phoneAreaCode, phoneNumber); + final DialableLandLineNumber landLine = new LandLineNumber(phoneCountry, phoneAreaCode, phoneNumber); // Set it in contact contact.setContactLandLineNumber(landLine); @@ -279,11 +276,11 @@ public class Contacts implements Serializable { } else { // Yes, then update as well contact.getContactMobileNumber().setMobileProvider(mobileProvider); - contact.getContactMobileNumber().setPhoneNumber(mobileNumber); + contact.getContactMobileNumber().setMobileNumber(mobileNumber); } } else if ((mobileProvider instanceof MobileProvider) && (mobileNumber > 0)) { // Create new instance - DialableMobileNumber mobile = new MobileNumber(mobileProvider, mobileNumber); + final DialableMobileNumber mobile = new MobileNumber(mobileProvider, mobileNumber); // Set it in contact contact.setContactMobileNumber(mobile);