private String faxNumber;
/**
- * Gender code of the contact: - M = Mr. (male) - F = Mrs. (female) - C =
- * Company
+ * Gender instance
*/
- private char gender;
+ private Gender gender;
/**
* House number
Contact contact = (Contact) object;
// Now test some data @todo Definedly needs improvement
- return ((this.getGender() == contact.getGender())
+ return ((this.getGender().equals(contact.getGender()))
&& (this.getSurname().toLowerCase().equals(contact.getSurname().toLowerCase()))
&& (this.getFamilyName().toLowerCase().equals(contact.getFamilyName().toLowerCase())));
}
String csvString = String.format(
"\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\"\n",
this.isOwnContact(),
- this.getGender(),
+ this.getGender().getDatabaseValue(),
this.getSurname(),
this.getFamilyName(),
this.getCompanyName(),
*
* @return the gender
*/
- public char getGender () {
+ public Gender getGender () {
return this.gender;
}
*
* @param gender the gender to set
*/
- private void setGender (final char gender) {
+ private void setGender (final Gender gender) {
this.gender = gender;
}
// "Translate" it
switch (this.getGender()) {
- case 'M': // Mr.
+ case MALE: // Mr.
translated = "Herr";
break;
- case 'F': // Mrs.
+ case FEMALE: // Mrs.
translated = "Frau";
break;
- case 'C': // "Company"
+ case COMPANY: // "Company"
translated = "Firma";
break;
public int hashCode () {
int hash = 7;
hash = 79 * hash + Objects.hashCode(this.getFamilyName());
- hash = 79 * hash + this.getGender();
+ hash = 79 * hash + this.getGender().hashCode();
hash = 79 * hash + Objects.hashCode(this.getSurname());
return hash;
}
* @param familyName Family name
* @param companyName Company name
*/
- public void updateNameData (final char gender, final String surname, final String familyName, final String companyName) {
+ public void updateNameData (final Gender gender, final String surname, final String familyName, final String companyName) {
// Set all
this.setGender(gender);
+
if (surname != null) {
this.setSurname(surname);
}