dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
+file.reference.jcoreee.jar=lib/jcoreee.jar
includes=**
jar.compress=false
javac.classpath=\
- ${libs.jpa20-persistence.classpath}
+ ${libs.jpa20-persistence.classpath}:\
+ ${file.reference.jcoreee.jar}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
javac.deprecation=true
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
+source.reference.jcoreee.jar=../jcoreee/src/
src.dir=src
test.src.dir=test
/*
- * Copyright (C) 2018 Roland Häder<roland@mxchange.org>
+ * 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
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
+import org.mxchange.jcoreee.utils.Comparables;
/**
* A POJO for country data
@Override
public int compareTo (final Country country) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ // For performance reasons
+ if (null == country) {
+ // Should not happen
+ throw new NullPointerException("country is null"); //NOI18N
+ } else if (Objects.equals(this, country)) {
+ // Same object
+ return 0;
+ }
+
+ // Init comparators
+ final int comparators[] = {
+ // First check country code, clear indication ...
+ this.getCountryCode().compareTo(country.getCountryCode()),
+ // ... and phone code, too
+ this.getCountryPhoneCode().compareTo(country.getCountryPhoneCode()),
+ // ... then last i18n key
+ this.getCountryI18nKey().compareTo(country.getCountryI18nKey())
+ };
+
+ // Check all values
+ final int comparison = Comparables.checkAll(comparators);
+
+ // Return value
+ return comparison;
}
@Override