View Javadoc
1   /*
2    * Copyright (C) 2022-2023 Dipl.-Inform. Kai Hofmann. All rights reserved!
3    */
4   package de.powerstat.validation.values;
5   
6   
7   import de.powerstat.validation.interfaces.IValueObject;
8   
9   
10  /**
11   * Gender/Sex.
12   *
13   * This is my own derivation of the following website:
14   * https://at.wikimannia.org/60_Geschlechtsidentit%C3%A4ten
15   * From my point of view trans-gender is not a gender - it is a change of the gender over time.
16   * For example when someone is born as male he will become a female after a transformation.
17   * During the transformation BOTH or VARIABLE might be used.
18   * This will be handled in the Person class by a history of the gender.
19   *
20   * @see <a href="https://at.wikimannia.org/60_Geschlechtsidentitäten">Geschlechtsidentitäten</a>
21   *
22   * Not DSGVO relevant.
23   */
24  public enum Gender implements IValueObject
25   {
26    /**
27     * Unknown/undefined gender.
28     */
29    UNKNOWN(0),
30  
31    /**
32     * Female.
33     */
34    FEMALE(1),
35  
36    /**
37     * Male.
38     */
39    MALE(2),
40  
41    /**
42     * Both female and male at the same time.
43     */
44    BOTH(3),
45  
46    /**
47     * Variable, female today, male tomorrow for example (not trans).
48     */
49    VARIABLE(4),
50  
51    /**
52     * Without a gender/sex.
53     */
54    NEUTRAL(5),
55  
56    /**
57     * Other not here named gender.
58     */
59    OTHER(6);
60  
61  
62    /**
63     * Action number.
64     */
65    private final int action;
66  
67  
68    /**
69     * Ordinal constructor.
70     *
71     * @param action Action number
72     */
73    Gender(final int action)
74     {
75      this.action = action;
76     }
77  
78  
79    /**
80     * Gender factory.
81     *
82     * @param value Gender name string
83     * @return Gender object
84     */
85    public static Gender of(final String value)
86     {
87      return Gender.valueOf(value);
88     }
89  
90  
91    /**
92     * Get action number.
93     *
94     * @return Action number
95     */
96    public int getAction()
97     {
98      return this.action;
99     }
100 
101 
102   /**
103    * Returns the value of this Gender as a string.
104    *
105    * @return The text value represented by this object after conversion to type string.
106    */
107   @Override
108   public String stringValue()
109    {
110     return this.name();
111    }
112 
113  }