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

    Nested classes/interfaces inherited from class java.lang.Enum

    java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
  • 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

    Fields 
    Modifier and Type Field Description
    java.lang.String label
    A String value corresponding to each Gender Enum.
    int value
    A integer value corresponding to each Gender Enum.
  • 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.

    Methods inherited from class java.lang.Enum

    clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • FEMALE

      public static final Gender FEMALE
      Enum value corresponding to Female persons.
    • MALE

      public static final Gender MALE
      Enum value corresponding to Male persons.
    • NONBINARY

      public static final Gender NONBINARY
      Enum value corresponding to Non-Binary persons.
    • PREFER_NOT_TO_SAY

      public static final Gender PREFER_NOT_TO_SAY
      Enum value corresponding Persons that prefer not to say their Genders.
  • Field Details

    • label

      public final java.lang.String label
      A String value corresponding to each Gender Enum.
    • value

      public final int value
      A integer value corresponding to each Gender Enum.
  • 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

      public static Gender[] 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

      public static Gender valueOf​(java.lang.String name)
      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 name
      java.lang.NullPointerException - if the argument is null
    • getGender

      public static Gender getGender​(java.lang.String gender)
      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

      protected static Gender getGender​(int gender)
      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.