From: Roland Häder Date: Mon, 19 Mar 2018 01:07:48 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=65109f87fe78a3f870a2322c158e014e17a7abb5;p=jcontacts-business-core.git Continued: - added utitlities class BasicDataUtils - updated commons-lang3 to 3.7 Signed-off-by: Roland Häder --- diff --git a/lib/nblibraries.properties b/lib/nblibraries.properties index 679f576..6d2e94d 100644 --- a/lib/nblibraries.properties +++ b/lib/nblibraries.properties @@ -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 index 0000000..603f0de --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/basicdata/BasicDataUtils.java @@ -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 . + */ +package org.mxchange.jcontactsbusiness.model.basicdata; + +import java.io.Serializable; +import java.util.Objects; + +/** + * An utilities class for basic company data + *

+ * @author Roland Häder + */ +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. + *

+ * @param basicData1 Basic company data instance 1 + * @param basicData2 Basic company data instance 2 + *

+ * @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 + } + +}