import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
+import org.apache.commons.lang3.StringUtils;
import org.mxchange.jcoreutils.Comparables;
/**
// Init comparators
final int comparators[] = {
// First check country code, clear indication ...
- this.getCountryCode().compareTo(country.getCountryCode()),
+ StringUtils.compare(this.getCountryCode(), country.getCountryCode()),
// ... and phone code, too
this.getCountryPhoneCode().compareTo(country.getCountryPhoneCode()),
// ... then last i18n key
- this.getCountryI18nKey().compareTo(country.getCountryI18nKey())
+ StringUtils.compare(this.getCountryI18nKey(), country.getCountryI18nKey()),
+ // ... abroad dial prefix
+ StringUtils.compare(this.getCountryAbroadDialPrefix(), country.getCountryAbroadDialPrefix()),
+ // ... external dial prefix
+ StringUtils.compare(this.getCountryExternalDialPrefix(), country.getCountryExternalDialPrefix())
};
// Check all values
// @todo Maybe a bit unsafe cast?
final Country country = (Country) object;
- if (!Objects.equals(this.getCountryId(), country.getCountryId())) {
+ if (!Objects.equals(this.getCountryAbroadDialPrefix(), country.getCountryAbroadDialPrefix())) {
return false;
} else if (!Objects.equals(this.getCountryCode(), country.getCountryCode())) {
return false;
- } else if (!Objects.equals(this.getCountryAbroadDialPrefix(), country.getCountryAbroadDialPrefix())) {
- return false;
} else if (!Objects.equals(this.getCountryExternalDialPrefix(), country.getCountryExternalDialPrefix())) {
return false;
- } else if (!Objects.equals(this.getCountryPhoneCode(), country.getCountryPhoneCode())) {
- return false;
} else if (!Objects.equals(this.getCountryI18nKey(), country.getCountryI18nKey())) {
return false;
+ } else if (!Objects.equals(this.getCountryId(), country.getCountryId())) {
+ return false;
+ } else if (!Objects.equals(this.getCountryIsLocalPrefixRequired(), country.getCountryIsLocalPrefixRequired())) {
+ return false;
+ } else if (!Objects.equals(this.getCountryPhoneCode(), country.getCountryPhoneCode())) {
+ return false;
}
return true;
public int hashCode () {
int hash = 7;
- hash = 41 * hash + Objects.hashCode(this.getCountryId());
- hash = 41 * hash + Objects.hashCode(this.getCountryCode());
hash = 41 * hash + Objects.hashCode(this.getCountryAbroadDialPrefix());
+ hash = 41 * hash + Objects.hashCode(this.getCountryCode());
hash = 41 * hash + Objects.hashCode(this.getCountryExternalDialPrefix());
- hash = 41 * hash + Objects.hashCode(this.getCountryPhoneCode());
hash = 41 * hash + Objects.hashCode(this.getCountryI18nKey());
+ hash = 41 * hash + Objects.hashCode(this.getCountryId());
+ hash = 41 * hash + Objects.hashCode(this.getCountryIsLocalPrefixRequired());
+ hash = 41 * hash + Objects.hashCode(this.getCountryPhoneCode());
return hash;
}