Package MySTARS
Enum Gender
java.lang.Object
java.lang.Enum<Gender>
MySTARS.Gender
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Gender>
,java.lang.constant.Constable
public enum Gender extends java.lang.Enum<Gender>
Gender Enum that keeps track of the different Genders of the students.
- Since:
- 2020-11-1
- Version:
- 1.0
- Author:
- Bhargav
-
Nested Class Summary
-
Enum Constant Summary
Enum Constants Enum Constant Description FEMALE
Enum value corresponding to Female persons.MALE
Enum value corresponding to Male persons.NONBINARY
Enum value corresponding to Non-Binary persons.PREFER_NOT_TO_SAY
Enum value corresponding Persons that prefer not to say their Genders. -
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description private
Gender(java.lang.String label, int value)
An initialiser for each Gender Enum. -
Method Summary
Modifier and Type Method Description protected static Gender
getGender(int gender)
A helper method to get the Gender from a String input.static Gender
getGender(java.lang.String gender)
A helper method to get the Gender from a String input.static Gender
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Gender[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
FEMALE
Enum value corresponding to Female persons. -
MALE
Enum value corresponding to Male persons. -
NONBINARY
Enum value corresponding to Non-Binary persons. -
PREFER_NOT_TO_SAY
Enum value corresponding Persons that prefer not to say their Genders.
-
-
Field Details
-
Constructor Details
-
Gender
private Gender(java.lang.String label, int value)An initialiser for each Gender Enum.- Parameters:
label
- The String value corresponding to the Enum.value
- The integer value correspoinding to the Enum.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getGender
A helper method to get the Gender from a String input.- Parameters:
gender
- The desired Gender as a String.- Returns:
- The matching Gender. Defaults to Prefer Not To Say for invalid inputs.
-
getGender
A helper method to get the Gender from a String input.- Parameters:
gender
- The desired Gender as a String.- Returns:
- The matching Gender. Defaults to Prefer Not To Say for invalid inputs.
-