Package hec.rss.model

Enum Class DayOfWeek

java.lang.Object
java.lang.Enum<DayOfWeek>
hec.rss.model.DayOfWeek
All Implemented Interfaces:
Serializable, Comparable<DayOfWeek>, java.lang.constant.Constable

public enum DayOfWeek extends Enum<DayOfWeek>
* A day-of-week, such as 'Tuesday'.

DayOfWeek is an enum representing the 7 days of the week - Sunday, Monday, Tuesday, Wednesday, Thursday, Friday and Saturday.

In addition to the textual enum name, each day-of-week has an int value. The int value from 1 (Sunday) to 7 (Saturday). It is recommended that applications use the enum rather than the int value to ensure code clarity.

Do not use ordinal() to obtain the numeric representation of DayOfWeek. Use getValue() instead.

This enum represents a common concept that is found in many calendar systems.

  • Enum Constant Details

    • Sunday

      public static final DayOfWeek Sunday
      The singleton instance for the day-of-week of Sunday. This has the numeric value of 1.
    • Monday

      public static final DayOfWeek Monday
      The singleton instance for the day-of-week of Monday. This has the numeric value of 2.
    • Tuesday

      public static final DayOfWeek Tuesday
      The singleton instance for the day-of-week of Tuesday. This has the numeric value of 3.
    • Wednesday

      public static final DayOfWeek Wednesday
      The singleton instance for the day-of-week of Wednesday. This has the numeric value of 4.
    • Thursday

      public static final DayOfWeek Thursday
      The singleton instance for the day-of-week of Thursday. This has the numeric value of 5.
    • Friday

      public static final DayOfWeek Friday
      The singleton instance for the day-of-week of Friday. This has the numeric value of 6.
    • Saturday

      public static final DayOfWeek Saturday
      The singleton instance for the day-of-week of Saturday. This has the numeric value of 7.
  • Method Details

    • values

      public static DayOfWeek[] 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 DayOfWeek 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
    • getValue

      public int getValue()
      Gets the day-of-week int value.

      The values are numbered from 1 (Sunday) to 7 (Saturday).

      Returns:
      the day-of-week, from 1 (Sunday) to 7 (Saturday)
    • getName

      public String getName()
      Gets the textual representation, such as 'Monday' or 'Friday'.

      This returns the textual name used to identify the day-of-week, suitable for presentation to the user.

      Returns:
      the text value of the day-of-week, not null
    • getShortName

      public String getShortName()
      Gets the textual representation, such as 'Mon' or 'Fri'.

      This returns the short textual name used to identify the day-of-week, suitable for presentation to the user.

      Returns:
      the short text value of the day-of-week, not null
    • minus

      public DayOfWeek minus(long days)
      returns the day-of-week that is the specified number of days before this one
      Parameters:
      days -
      Returns:
    • plus

      public DayOfWeek plus(long days)
      Returns the day-of-week that is the specified number of days after this one.

      The calculation rolls around the end of the week from Saturday to Sunday. The specified period may be negative.

      This instance is immutable and unaffected by this method call.

      Parameters:
      days - the days to add, positive or negative
      Returns:
      the resulting day-of-week, not null
    • getDayOfWeek

      public static DayOfWeek getDayOfWeek(int value)
      Obtains an instance of DayOfWeek from an int value.

      DayOfWeek is an enum representing the 7 days of the week. This factory allows the enum to be obtained from the int value. The int value from 1 (Sunday) to 7 (Saturday).

      Parameters:
      dayOfWeek - the day-of-week to represent, from 1 (Sunday) to 7 (Saturday)
      Returns:
      the day-of-week singleton, or null if invalid value
    • getDayOfWeek

      public static DayOfWeek getDayOfWeek(String name)
      Obtains an instance of DayOfWeek from an String value.

      DayOfWeek is an enum representing the 7 days of the week. This factory allows the enum to be obtained from the String value. The String value from "Sunday" or "Sun" (Sunday) to "Saturday" or "Sat" (Saturday).

      Parameters:
      dayOfWeek - the day-of-week to represent, from "Sunday" or "Sun" (Sunday) to "Saturday" or "Sat" (Saturday)
      Returns:
      the day-of-week singleton, or null if invalid value