From: Roland Haeder Date: Thu, 1 Oct 2015 12:50:03 +0000 (+0200) Subject: Continued rewriting: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=35fd38625e2cdebef799b844ee59783c159379f8;p=jcore.git Continued rewriting: - moved out contact stuff to jcontacts-lib and addressbook-lib - removed persistence API Signed-off-by:Roland Häder --- diff --git a/lib/jpa20-persistence/javax.persistence-2.1.0-doc.zip b/lib/jpa20-persistence/javax.persistence-2.1.0-doc.zip deleted file mode 100644 index fd55e6e..0000000 Binary files a/lib/jpa20-persistence/javax.persistence-2.1.0-doc.zip and /dev/null differ diff --git a/lib/jpa20-persistence/javax.persistence_2.1.0.v201304241213.jar b/lib/jpa20-persistence/javax.persistence_2.1.0.v201304241213.jar deleted file mode 100644 index 841d2e1..0000000 Binary files a/lib/jpa20-persistence/javax.persistence_2.1.0.v201304241213.jar and /dev/null differ diff --git a/nbproject/project.properties b/nbproject/project.properties index dd5df51..71d2323 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -34,8 +34,7 @@ includes=** jar.archive.disabled=${jnlp.enabled} jar.compress=false jar.index=${jnlp.enabled} -javac.classpath=\ - ${libs.jpa20-persistence.classpath} +javac.classpath= # Space-separated list of extra javac options javac.compilerargs=-Xlint:unchecked -Xlint:deprecation javac.deprecation=true diff --git a/src/org/mxchange/jcore/BaseFrameworkSystem.java b/src/org/mxchange/jcore/BaseFrameworkSystem.java index 5597436..2656f85 100644 --- a/src/org/mxchange/jcore/BaseFrameworkSystem.java +++ b/src/org/mxchange/jcore/BaseFrameworkSystem.java @@ -21,7 +21,6 @@ import java.util.StringTokenizer; import org.mxchange.jcore.application.Application; import org.mxchange.jcore.client.Client; import org.mxchange.jcore.manager.Manageable; -import org.mxchange.jcore.model.contact.Contact; /** * General class @@ -50,11 +49,6 @@ public abstract class BaseFrameworkSystem implements FrameworkInterface { */ private Client client; - /** - * Contact instance - */ - private Contact contact; - /** * Manager instance */ @@ -164,24 +158,6 @@ public abstract class BaseFrameworkSystem implements FrameworkInterface { return this.manager; } - /** - * Getter for Contact instance - *

- * @return Contact instance - */ - protected Contact getContact () { - return this.contact; - } - - /** - * Setter for Contact instance - *

- * @param contact A Contact instance - */ - protected void setContact (final Contact contact) { - this.contact = contact; - } - /** * Manager instance *

diff --git a/src/org/mxchange/jcore/client/Client.java b/src/org/mxchange/jcore/client/Client.java index cd5bc0e..40ead40 100644 --- a/src/org/mxchange/jcore/client/Client.java +++ b/src/org/mxchange/jcore/client/Client.java @@ -19,7 +19,6 @@ package org.mxchange.jcore.client; import java.io.IOException; import java.sql.SQLException; import org.mxchange.jcore.FrameworkInterface; -import org.mxchange.jcore.model.contact.Contact; /** * An interface for application clients @@ -28,27 +27,6 @@ import org.mxchange.jcore.model.contact.Contact; */ public interface Client extends FrameworkInterface { - /** - * Displays a "box" for the address - *

- * @param contact Contact to show address from - */ - public void displayAddressBox (final Contact contact); - - /** - * Displays a "box" for the name - *

- * @param contact Contact to show name from - */ - public void displayNameBox (final Contact contact); - - /** - * Displays a "box" for other data - *

- * @param contact Contact to show other data from - */ - public void displayOtherDataBox (final Contact contact); - /** * Shuts down the client and therefore whole application *

@@ -81,13 +59,6 @@ public interface Client extends FrameworkInterface { */ public void outputMessage (final String message); - /** - * Shows given contact instamce - * - * @param contact Contact instance - */ - public void show (final Contact contact); - /** * Shows introduction to user */ diff --git a/src/org/mxchange/jcore/model/contact/Contact.java b/src/org/mxchange/jcore/model/contact/Contact.java deleted file mode 100644 index 41cb0de..0000000 --- a/src/org/mxchange/jcore/model/contact/Contact.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (C) 2015 Roland Haeder - * - * 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.jcore.model.contact; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.Date; -import org.mxchange.jcore.model.contact.gender.Gender; - -/** - * A general contact interface - *

- * @author Roland Haeder - */ -public interface Contact extends Serializable { - - /** - * Copies all attributes from other contact object to this - *

- * @param contact Source instance - */ - public void copyAll (final Contact contact); - - /** - * Birth day - *

- * @return the birthday - */ - public Date getBirthday (); - - /** - * Birth day - *

- * @param birthday the birthday to set - */ - public void setBirthday (final Date birthday); - - /** - * Cellphone number - *

- * @return the cellphoneNumber - */ - public String getCellphoneNumber (); - - /** - * Cellphone number - *

- * @param cellphoneNumber the cellphoneNumber to set - */ - public void setCellphoneNumber (final String cellphoneNumber); - - /** - * City - *

- * @return the city - */ - public String getCity (); - - /** - * City - *

- * @param city the city to set - */ - public void setCity (final String city); - - /** - * Comments - *

- * @return the comment - */ - public String getComment (); - - /** - * Comments - *

- * @param comment the comment to set - */ - public void setComment (final String comment); - - /** - * Company name - *

- * @return the companyName - */ - public String getCompanyName (); - - /** - * Company name - *

- * @param companyName the companyName to set - */ - public void setCompanyName (final String companyName); - - /** - * Id number - *

- * @return the contactId - */ - public Long getContactId (); - - /** - * Id number - *

- * @param id the contactId to set - */ - public void setContactId (final Long id); - - /** - * Country code - *

- * @return the countryCode - */ - public String getCountryCode (); - - /** - * Country code - *

- * @param countryCode the countryCode to set - */ - public void setCountryCode (final String countryCode); - - /** - * Getter for "created" timestamp - *

- * @return "created" timestamp - */ - public Calendar getCreated (); - - /** - * Setter for "created" timestamp - *

- * @param created "created" timestamp - */ - public void setCreated (final Calendar created); - - /** - * Email address - *

- * @return the emailAddress - */ - public String getEmailAddress (); - - /** - * Email address - *

- * @param emailAddress the emailAddress to set - */ - public void setEmailAddress (final String emailAddress); - - /** - * Family name - *

- * @return the familyName - */ - public String getFamilyName (); - - /** - * Family name - *

- * @param familyName the familyName to set - */ - public void setFamilyName (final String familyName); - - /** - * Fax number - *

- * @return the faxNumber - */ - public String getFaxNumber (); - - /** - * Fax number - *

- * @param faxNumber the faxNumber to set - */ - public void setFaxNumber (final String faxNumber); - - /** - * First name - *

- * @return the first name - */ - public String getFirstName (); - - /** - * First name - *

- * @param firstName the first name to set - */ - public void setFirstName (final String firstName); - - /** - * Gender of the contact - *

- * @return the gender - */ - public Gender getGender (); - - /** - * Gender of the contact - *

- * @param gender the gender to set - */ - public void setGender (final Gender gender); - - /** - * House number - *

- * @return the houseNumber - */ - public Short getHouseNumber (); - - /** - * House number - *

- * @param houseNumber the houseNumber to set - */ - public void setHouseNumber (final Short houseNumber); - - /** - * Setter for own contact - *

- * @param ownContact Own contact - */ - public void setOwnContact (final Boolean ownContact); - - /** - * Phone number - *

- * @return the phoneNumber - */ - public String getPhoneNumber (); - - /** - * Phone number - *

- * @param phoneNumber the phoneNumber to set - */ - public void setPhoneNumber (final String phoneNumber); - - /** - * Street - *

- * @return the street - */ - public String getStreet (); - - /** - * Street - *

- * @param street the street to set - */ - public void setStreet (final String street); - - /** - * Getter for "updated" timestamp - *

- * @return "updated" timestamp - */ - public Calendar getUpdated (); - - /** - * Getter for "updated" timestamp - *

- * @param updated "updated" timestamp - */ - public void setUpdated (final Calendar updated); - - /** - * ZIP code - *

- * @return the zipCode - */ - public Long getZipCode (); - - /** - * ZIP code - *

- * @param zipCode the zipCode to set - */ - public void setZipCode (final Long zipCode); - - /** - * Checks whether the contact is user's own data - *

- * @return Own data? - */ - public Boolean isOwnContact (); -} diff --git a/src/org/mxchange/jcore/model/contact/UserContact.java b/src/org/mxchange/jcore/model/contact/UserContact.java deleted file mode 100644 index 3fe979a..0000000 --- a/src/org/mxchange/jcore/model/contact/UserContact.java +++ /dev/null @@ -1,485 +0,0 @@ -/* - * Copyright (C) 2015 Roland Haeder - * - * 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.jcore.model.contact; - -import java.util.Calendar; -import java.util.Date; -import java.util.Objects; -import javax.annotation.PostConstruct; -import javax.persistence.Basic; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Lob; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import org.mxchange.jcore.model.contact.gender.Gender; - -/** - * A general contact class which should only be extended. - *

- * @author Roland Haeder - * @version 0.0 - */ -@Entity (name = "contacts") -@Table (name = "contacts") -public class UserContact implements Contact, Comparable { - - /** - * Serial number - */ - private static final long serialVersionUID = 58_744_284_981_863L; - - /** - * Birth day - */ - @Column (name = "birthday") - @Temporal (TemporalType.DATE) - private Date birthday; - - /** - * Cellphone number - */ - @Column (name = "cellphone_number", length = 100) - private String cellphoneNumber; - - /** - * City - */ - @Column (name = "city", nullable = false, length = 100) - private String city; - - /** - * Optional comments - */ - @Lob - @Column (name = "comment") - private String comment; - - /** - * Company name - */ - @Column (name = "company_name", nullable = false) - private String companyName; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "contact_id", length = 20, updatable = false) - private Long contactId; - - /** - * Country code - */ - @Column (name = "country_code", length = 2, nullable = false) - private String countryCode; - - /** - * When the contact has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "created", nullable = false) - private Calendar created; - - /** - * Email address - */ - @Column (name = "email_address", length = 100, nullable = false) - private String emailAddress; - - /** - * Family name - */ - @Basic (optional = false) - @Column (name = "family_name", length = 100, nullable = false) - private String familyName; - - /** - * Fax number - */ - @Column (name = "fax_number", length = 100) - private String faxNumber; - - /** - * First name - */ - @Basic (optional = false) - @Column (name = "first_name", length = 100, nullable = false) - private String firstName; - - /** - * Gender instance - */ - @Basic (optional = false) - @Column (name = "gender", nullable = false) - @Enumerated (EnumType.STRING) - private Gender gender; - - /** - * House number - */ - @Column (name = "house_number", length = 5, nullable = false) - private Short houseNumber; - - /** - * Flag whether this contact is user's own data - */ - @Column (name = "own_contact", nullable = false) - private Boolean ownContact; - - /** - * Phone number - */ - @Column (name = "phone_number", length = 100) - private String phoneNumber; - - /** - * Street - */ - @Column (name = "street", nullable = false) - private String street; - - /** - * When the contact has been updated - */ - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "updated") - private Calendar updated; - - /** - * ZIP code - */ - @Column (name = "zip_code", nullable = false, length = 6) - private Long zipCode; - - /** - * Constructor for gender and names - *

- * @param gender Gender instance - * @param firstName First name - * @param familyName Family name - * @param companyName Company name - */ - public UserContact (final Gender gender, final String firstName, final String familyName, final String companyName) { - // Set all - this.gender = gender; - this.firstName = firstName; - this.familyName = familyName; - } - - /** - * Default constructor - */ - public UserContact () { - } - - /** - * Compares two contacts with each other - *

- * @param contact Contact comparator - * @return Comparison value - */ - @Override - public int compareTo (final Contact contact) { - // contact should not be null - if (null == contact) { - throw new NullPointerException("contact is null"); //NOI18N - } - - // Is the contactId the same? - if (Objects.equals(this.getContactId(), contact.getContactId())) { - // Same contactId, means same contact - return 0; - } else if (this.getContactId() > contact.getContactId()) { - // This contactId is larger than compared to - return -1; - } - - // The other contactId is larger - return 1; - } - - @Override - public void copyAll (final Contact contact) { - // Copy all: - // - base data - this.setFirstName(contact.getFirstName()); - this.setFamilyName(contact.getFamilyName()); - this.setCompanyName(contact.getCompanyName()); - this.setStreet(contact.getStreet()); - this.setZipCode(contact.getZipCode()); - this.setCity(contact.getCity()); - this.setCountryCode(contact.getCountryCode()); - - // - phone, fax, email - this.setPhoneNumber(contact.getPhoneNumber()); - this.setFaxNumber(contact.getFaxNumber()); - this.setCellphoneNumber(contact.getCellphoneNumber()); - - // - other data - this.setBirthday(contact.getBirthday()); - this.setComment(contact.getComment()); - this.setCreated(contact.getCreated()); - this.setUpdated(contact.getUpdated()); - } - - /** - * Check if contacts are same or throw an exception - *

- * @param object Other possible contact class - * @return Whether both contacts are same TODO Needs a lot improvements - */ - @Override - public boolean equals (final Object object) { - // Is it same type? - if (!(object instanceof UserContact)) { - // Not equal types - return false; - } else if (!(object instanceof Contact)) { - // Not correct interface - return false; - } - - // Try to cast - Contact contact = (Contact) object; - - // Now test some data TODO Definedly needs improvement - return ((this.getGender().equals(contact.getGender())) - && (this.getFirstName().toLowerCase().equals(contact.getFirstName().toLowerCase())) - && (this.getFamilyName().toLowerCase().equals(contact.getFamilyName().toLowerCase()))); - } - - @Override - public Date getBirthday () { - return this.birthday; - } - - @Override - public void setBirthday (final Date birthday) { - this.birthday = birthday; - } - - @Override - public String getCellphoneNumber () { - return this.cellphoneNumber; - } - - @Override - public void setCellphoneNumber (final String cellphoneNumber) { - this.cellphoneNumber = cellphoneNumber; - } - - @Override - public String getCity () { - return this.city; - } - - @Override - public void setCity (final String city) { - this.city = city; - } - - @Override - public String getComment () { - return this.comment; - } - - @Override - public void setComment (final String comment) { - this.comment = comment; - } - - @Override - public String getCompanyName () { - return this.companyName; - } - - @Override - public void setCompanyName (final String companyName) { - this.companyName = companyName; - } - - @Override - public Long getContactId () { - return this.contactId; - } - - @Override - public void setContactId (final Long contactId) { - this.contactId = contactId; - } - - @Override - public String getCountryCode () { - return this.countryCode; - } - - @Override - public void setCountryCode (final String countryCode) { - this.countryCode = countryCode; - } - - @Override - public Calendar getCreated () { - return this.created; - } - - @Override - public void setCreated (final Calendar created) { - this.created = created; - } - - @Override - public String getEmailAddress () { - return this.emailAddress; - } - - @Override - public void setEmailAddress (final String emailAddress) { - this.emailAddress = emailAddress; - } - - @Override - public String getFamilyName () { - //* NOISY-DEBUG: */ this.getLogger().logTrace("CALLED!"); - return this.familyName; - } - - @Override - public void setFamilyName (final String familyName) { - this.familyName = familyName; - } - - @Override - public String getFaxNumber () { - return this.faxNumber; - } - - @Override - public void setFaxNumber (final String faxNumber) { - this.faxNumber = faxNumber; - } - - @Override - public String getFirstName () { - return this.firstName; - } - - @Override - public void setFirstName (final String firstName) { - this.firstName = firstName; - } - - @Override - public Gender getGender () { - return this.gender; - } - - @Override - public void setGender (final Gender gender) { - this.gender = gender; - } - - @Override - public Short getHouseNumber () { - return this.houseNumber; - } - - @Override - public void setHouseNumber (final Short houseNumber) { - this.houseNumber = houseNumber; - } - - @Override - public void setOwnContact (final Boolean ownContact) { - this.ownContact = ownContact; - } - - @Override - public String getPhoneNumber () { - return this.phoneNumber; - } - - @Override - public void setPhoneNumber (final String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - @Override - public String getStreet () { - return this.street; - } - - @Override - public void setStreet (final String street) { - this.street = street; - } - - @Override - public Calendar getUpdated () { - return this.updated; - } - - @Override - public void setUpdated (final Calendar updated) { - this.updated = updated; - } - - @Override - public Long getZipCode () { - return this.zipCode; - } - - @Override - public void setZipCode (final Long zipCode) { - this.zipCode = zipCode; - } - - @Override - public int hashCode () { - // Validate gender instance - assert (this.getGender() instanceof Gender) : "gender is not set."; //NOI18N - - int hash = 7; - hash = 79 * hash + Objects.hashCode(this.getFamilyName()); - hash = 79 * hash + this.getGender().hashCode(); - hash = 79 * hash + Objects.hashCode(this.getFirstName()); - return hash; - } - - /** - * Initialization with fake gender UNKNOWN - */ - @PostConstruct - public void init () { - // Fake gender - this.gender = Gender.UNKNOWN; - } - - @Override - public Boolean isOwnContact () { - return this.ownContact; - } -} diff --git a/src/org/mxchange/jcore/model/contact/gender/Gender.java b/src/org/mxchange/jcore/model/contact/gender/Gender.java deleted file mode 100644 index bc8747b..0000000 --- a/src/org/mxchange/jcore/model/contact/gender/Gender.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2015 Roland Haeder - * - * 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.jcore.model.contact.gender; - -import java.io.Serializable; -import java.text.MessageFormat; - -/** - * Gender enum - *

- * @author Roland Haeder - */ -public enum Gender implements Serializable { - - /** - * Unknown enum - */ - UNKNOWN('U', "GENDER_UNKNOWN"), //NOI18N - - /** - * Male enum - */ - MALE('M', "GENDER_MALE"), //NOI18N - - /** - * Female enum - */ - FEMALE('F', "GENDER_FEMALE"), //NOI18N - - /** - * Company enum - */ - COMPANY('C', "GENDER_COMPANY"); //NOI18N - - /** - * Cache for valid chars - */ - private static char[] validChars; - - /** - * Access key being entered by ConsoleClient - */ - private final char accessChar; - - /** - * Output value (for messages) - */ - private final String messageKey; - - /** - * Getter for Gender enum from given character - *

- * @param c Gender character - * @return Gender enum - */ - public static Gender fromChar (final char c) { - // Init variable - Gender g = null; - - // Loop through all - for (final Gender gender : GenderUtils.selectableGenders()) { - // Does the char match? - if (c == gender.getAccessChar()) { - // Found it - g = gender; - break; - } - } - - // Still null? - if (null == g) { - // Didn't found a valid one - throw new IllegalArgumentException(MessageFormat.format("Gender {0} is invalid.", c)); //NOI18N - } - - // Return it - //* NOISY-DEBUG: */ System.out.println("gender=" + g.getClass().getName()); - return g; - } - - /** - * Valid chars (mostly for console client) - *

- * @return Valid chars - */ - public static char[] validChars () { - // Is cache set? - if (validChars != null) { - // Return it - return validChars; - } - - // Init array, only 3 are valid as 'U' is UNKNOWN and is not valid. - char[] valid = new char[3]; - - // Get values - int i = 0; - for (final Gender gender : GenderUtils.selectableGenders()) { - // Debug message - //* NOISY-DEBUG: */ System.out.println("gender=" + gender); - - // Debug message - //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("gender={0} - adding at pos {1} ...", gender, i)); - // Get access key as this is also the access - valid[i] = gender.getAccessChar(); - - // Increment index - i++; - } - - // Set it here - validChars = valid; - - // Return finialized array - return valid; - } - - /** - * Constructor - *

- * @param accessChar Value being entered by ConsoleClient - * @param messageKey Message key for resource file - */ - private Gender (final char accessChar, final String messageKey) { - // Set both - this.accessChar = accessChar; - this.messageKey = messageKey; - } - - /** - * Acces key (console client mostly) - *

- * @return the accessChar - */ - public char getAccessChar () { - return this.accessChar; - } - - /** - * Output value (for messages) - *

- * @return the messageKey - */ - public String getMessageKey () { - return this.messageKey; - } -} diff --git a/src/org/mxchange/jcore/model/contact/gender/GenderUtils.java b/src/org/mxchange/jcore/model/contact/gender/GenderUtils.java deleted file mode 100644 index b4d1ec7..0000000 --- a/src/org/mxchange/jcore/model/contact/gender/GenderUtils.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2015 Roland Haeder - * - * 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.jcore.model.contact.gender; - -import java.text.MessageFormat; -import java.util.LinkedList; -import java.util.List; -import org.mxchange.jcore.BaseFrameworkSystem; -import org.mxchange.jcore.model.contact.Contact; - -/** - * Gender utils class - *

- * @author Roland Haeder - */ -public class GenderUtils extends BaseFrameworkSystem { - - /** - * Translates contact's gender to human-readable - *

- * @param contact Contact instance - * @return Translates value (from bundle) - */ - public static String getTranslatedGender (final Contact contact) { - // Init instance - GenderUtils utils = new GenderUtils(); - - // contact must be set - if (null == contact) { - // Abort here - throw new NullPointerException("contact is null"); - } else if (contact.getGender() == null) { - // Gender is not set - throw new NullPointerException(MessageFormat.format("contact {0} has no gender set.", contact)); - } - - // Get key from it - String key = contact.getGender().getMessageKey(); - - // Translate and return it - return utils.getMessageStringFromKey(key); - } - - /** - * Private contructor as this is an utility class - */ - private GenderUtils () { - } - - /** - * All selectable genders (not UNKNOWN) - *

- * @return Selectable genders (not UNKNOWN) - */ - public static List selectableGenders () { - // Init list - List list = new LinkedList<>(); - - // Walk through all genders - for (final Gender gender : Gender.values()) { - // Is it not UNKNOWN - if (!gender.equals(Gender.UNKNOWN)) { - // Add it - boolean added = list.add(gender); - - // Has it been added? - assert (added) : MessageFormat.format("gender {0} not added.", gender); //NOI18N - } - } - - // Return it - return list; - } -}