Enum Class Year

java.lang.Object
java.lang.Enum<Year>
net.pottercraft.ollivanders2.player.Year
All Implemented Interfaces:
Serializable, Comparable<Year>, Constable

public enum Year extends Enum<Year>
Represents the year this player is in school.
  • Enum Constant Details

    • YEAR_1

      public static final Year YEAR_1
      "1st", MagicLevel.BEGINNER
    • YEAR_2

      public static final Year YEAR_2
      "2nd", MagicLevel.BEGINNER
    • YEAR_3

      public static final Year YEAR_3
      "3rd", MagicLevel.OWL
    • YEAR_4

      public static final Year YEAR_4
      "4th", MagicLevel.OWL
    • YEAR_5

      public static final Year YEAR_5
      "5th", MagicLevel.NEWT
    • YEAR_6

      public static final Year YEAR_6
      "6th", MagicLevel.NEWT
    • YEAR_7

      public static final Year YEAR_7
      "7th", MagicLevel.EXPERT
  • Method Details

    • values

      public static Year[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Year valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getDisplayText

      @NotNull public @NotNull String getDisplayText()
      Get the text for writing this year, example: "3rd year"
      Returns:
      the display text for this year
    • getYearByValue

      @Nullable public static @Nullable Year getYearByValue(int value)
      Get the year that has the corresponding value
      Parameters:
      value - the value to get
      Returns:
      the Year if exists, null otherwise
    • getHighestLevelForYear

      public MagicLevel getHighestLevelForYear()
      The highest spell level this year can do without possible experience penalties.
      Returns:
      the maximum spell level