]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 19 Mar 2018 01:07:48 +0000 (02:07 +0100)
committerRoland Häder <roland@mxchange.org>
Mon, 19 Mar 2018 01:22:57 +0000 (02:22 +0100)
- added utitlities class BasicDataUtils
- updated commons-lang3 to 3.7

Signed-off-by: Roland Häder <roland@mxchange.org>
lib/nblibraries.properties
src/org/mxchange/jcontactsbusiness/model/basicdata/BasicDataUtils.java [new file with mode: 0644]

index 679f57622371bcc80bec477513e78cf826a2c225..6d2e94d82a512b0fc13f743b82c287ddc75182af 100644 (file)
@@ -1,6 +1,6 @@
 libs.commons-lang3.classpath=\
-    ${base}/commons-lang3/commons-lang3-3.5.jar
-libs.commons-lang3.displayName=Commons Lang3 3.5
+    ${base}/commons-lang3/commons-lang3-3.7.jar
+libs.commons-lang3.displayName=Commons Lang3 3.7
 libs.commons-lang3.javadoc=\
     https://commons.apache.org/proper/commons-lang/javadocs/api-release/
 libs.CopyLibs.classpath=\
diff --git a/src/org/mxchange/jcontactsbusiness/model/basicdata/BasicDataUtils.java b/src/org/mxchange/jcontactsbusiness/model/basicdata/BasicDataUtils.java
new file mode 100644 (file)
index 0000000..603f0de
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2018 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
+ * 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.jcontactsbusiness.model.basicdata;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * An utilities class for basic company data
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class BasicDataUtils implements Serializable {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 159_847_673_672_091L;
+
+       /**
+        * Compares both basic company data instances. This method returns -1 if
+        * second instance is null.
+        * <p>
+        * @param basicData1 Basic company data instance 1
+        * @param basicData2 Basic company data instance 2
+        * <p>
+        * @return Comparison value
+        */
+       public static int compare (final BasicData basicData1, final BasicData basicData2) {
+               // Check euqality, then at least first must be given
+               if (Objects.equals(basicData1, basicData2)) {
+                       // Both are same
+                       return 0;
+               } else if (null == basicData1) {
+                       // First is null
+                       return -1;
+               } else if (null == basicData2) {
+                       // Second is null
+                       return 1;
+               }
+
+               // Invoke compareTo() method
+               return basicData1.compareTo(basicData2);
+       }
+
+       /**
+        * Utility classes should not have instances
+        */
+       private BasicDataUtils () {
+               // Private constructor
+       }
+
+}