*/
package org.mxchange.addressbook.contact;
+import org.mxchange.addressbook.application.AddressbookApplication;
+
/**
* Gender enum
+ *
* @author Roland Haeder
*/
public enum Gender {
+
/**
* Unknown enum
*/
UNKNOWN("U", "BaseContact.gender.unknown.text"),
-
/**
* Male enum
*/
MALE("M", "BaseContact.gender.male.text"),
-
/**
* Female enum
*/
FEMALE("F", "BaseContact.gender.female.text"),
-
/**
* Company enum
*/
}
// Return it
+ //* NOISY-DEBUG: */ System.out.println("gender=" + g.getClass().getName());
return g;
}
/**
* Valid chars
- *
+ *
* @return Valid chars
*/
public static char[] validChars () {
// Debug message
//* NOISY-DEBUG: */ System.out.println("gender=" + gender);
-
- // Is it "U"?
- if (gender.getDatabaseValue().equals("U")) {
+ // Is it UNKNOWN?
+ if (gender.equals(Gender.UNKNOWN)) {
// Skip this
continue;
}
// Debug message
//* NOISY-DEBUG: */ System.out.println(MessageFormat.format("gender={0} - adding at pos {1} ...", gender, i));
-
// Get database value as this is also the access
valid[i] = gender.getDatabaseValue().charAt(0);
/**
* Constructor
- *
+ *
* @param databaseValue Value being stored in database
* @param messageKey Message key for resource file
*/
/**
* Database value
- *
+ *
* @return the databaseValue
*/
protected String getDatabaseValue () {
/**
* Output value (for messages)
- *
+ *
* @return the messageKey
*/
protected String getMessageKey () {
return this.messageKey;
}
+
+ /**
+ * Overwritten to return human-readable strings
+ *
+ * @return Human-readable strings
+ */
+ @Override
+ public String toString () {
+ // Get key from bundle and return it
+ return AddressbookApplication.getInstance().getMessageStringFromKey(this.getMessageKey());
+ }
}