]> git.mxchange.org Git - addressbook-lib.git/blobdiff - Addressbook/src/org/mxchange/addressbook/contact/user/UserContact.java
Added a lot trace messages + sanity checks for null references and such things
[addressbook-lib.git] / Addressbook / src / org / mxchange / addressbook / contact / user / UserContact.java
index 1f9b14186dfcb59d56ac65398b01cc54dba91f16..9208a067ed7cbd915ac7c5732084092f2eed4d8b 100644 (file)
@@ -1,55 +1,62 @@
-/*\r
- * Copyright (C) 2015 Roland Haeder\r
- *\r
- * This program is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package org.mxchange.addressbook.contact.user;\r
-\r
-import org.mxchange.addressbook.contact.Contact;\r
-import org.mxchange.addressbook.contact.book.BookContact;\r
-import org.mxchange.addressbook.database.storage.csv.StoreableCsv;\r
-\r
-/**\r
- *\r
- * @author Roland Haeder\r
- * @todo After a Collection has been used in ContactManager, change to BaseContact\r
- */\r
-public class UserContact extends BookContact implements Contact, StoreableCsv {\r
-\r
-    /**\r
-     * Creates own contact entry\r
-     *\r
-     * @param gender Gender to be set\r
-     * @param surname Surname to be set\r
-     * @param familyName Family name to be set\r
-     * @param companyName Company name\r
-     * @todo Add validation of data\r
-     */\r
-    public UserContact (final char gender, final String surname, final String familyName, final String companyName) {\r
-       // Make sure all constructors are called\r
-       this();\r
-\r
-       this.setGender(gender);\r
-       this.setSurname(surname);\r
-       this.setFamilyName(familyName);\r
-       this.setCompanyName(companyName);\r
-    }\r
-\r
-    /**\r
-     * Default constructor, may only be used from database backend\r
-     */\r
-    public UserContact () {\r
-       this.enableFlagOwnContact();\r
-    }\r
-}\r
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.contact.user;
+
+import java.text.MessageFormat;
+import org.mxchange.addressbook.contact.Contact;
+import org.mxchange.addressbook.contact.Gender;
+import org.mxchange.addressbook.contact.book.BookContact;
+import org.mxchange.addressbook.database.storage.csv.StoreableCsv;
+
+/**
+ *
+ * @author Roland Haeder
+ * @todo After a Collection has been used in ContactManager, change to
+ * BaseContact
+ */
+public class UserContact extends BookContact implements Contact, StoreableCsv {
+
+       /**
+        * Creates own contact entry
+        *
+        * @param gender Gender to be set
+        * @param surname Surname to be set
+        * @param familyName Family name to be set
+        * @param companyName Company name
+        * @todo Add validation of data
+        */
+       public UserContact (final Gender gender, final String surname, final String familyName, final String companyName) {
+               // Make sure all constructors are called
+               this();
+
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("gender={0},surname={1},familyName={2},companyName={3} - CALLED!", gender, surname, familyName, companyName)); //NOI18N
+
+               // Update all data
+               this.updateNameData(gender, surname, familyName, companyName);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
+       }
+
+       /**
+        * Default constructor, may only be used from database backend
+        */
+       public UserContact () {
+               this.enableFlagOwnContact();
+       }
+}