Package MySTARS
Enum DayOfWeek
java.lang.Object
java.lang.Enum<DayOfWeek>
MySTARS.DayOfWeek
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<DayOfWeek>
,java.lang.constant.Constable
public enum DayOfWeek extends java.lang.Enum<DayOfWeek>
An Enum that keeps track of the day of the week to simplify time tracking.
- Since:
- 2020-11-1
- Version:
- 1.0
- Author:
- Bhargav
-
Nested Class Summary
-
Enum Constant Summary
Enum Constants Enum Constant Description FRIDAY
Enum value representing Friday.MONDAY
Enum value representing Monday.SATURDAY
Enum value representing Saturday.SUNDAY
Enum value representing Sunday.THURSDAY
Enum value representing Thursday.TUESDAY
Enum value representing Tuesday.WEDNESDAY
Enum value representing Wednesday. -
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description private
DayOfWeek(java.lang.Integer value, java.lang.String label)
Initialiser for Enum DayOfWeek to ensure that all values have a label and a value. -
Method Summary
Modifier and Type Method Description static DayOfWeek
getDayOfWeek(int day)
Helper function that returns the corresponding DayOfWeek value for a given day in integer format.static DayOfWeek
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static DayOfWeek[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
Field Details
-
Constructor Details
-
DayOfWeek
private DayOfWeek(java.lang.Integer value, java.lang.String label)Initialiser for Enum DayOfWeek to ensure that all values have a label and a value.- Parameters:
value
- Integer value representing a day of the week, starting with 1 for Monday.label
- A String value corresponding to a day of the week, to 3 Characters.
-
-
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
-
getDayOfWeek
Helper function that returns the corresponding DayOfWeek value for a given day in integer format.- Parameters:
day
- The day of the week in integer form.- Returns:
- The DayOfWeek, defaults to Monday if int day is out of range.
-