java.lang.Object
java.lang.Enum<Week>
org.miaixz.bus.core.center.date.culture.en.Week
All Implemented Interfaces:
Serializable, Comparable<Week>, Constable

public enum Week extends Enum<Week>
星期枚举 与Calendar中的星期int值对应
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Enum Constant Details

    • SUNDAY

      public static final Week SUNDAY
      周日
    • MONDAY

      public static final Week MONDAY
      周一
    • TUESDAY

      public static final Week TUESDAY
      周二
    • WEDNESDAY

      public static final Week WEDNESDAY
      周三
    • THURSDAY

      public static final Week THURSDAY
      周四
    • FRIDAY

      public static final Week FRIDAY
      周五
    • SATURDAY

      public static final Week SATURDAY
      周六
  • Method Details

    • values

      public static Week[] 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 Week 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
    • of

      public static Week of(int code)
      Calendar星期相关值转换为Week枚举对象
      Parameters:
      code - Calendar中关于Week的int值,1表示Sunday
      Returns:
      Week
      See Also:
    • of

      public static Week of(String name) throws IllegalArgumentException
      解析别名为Week对象,别名如:sun或者SUNDAY,不区分大小写
      Parameters:
      name - 别名值
      Returns:
      周枚举Week,非空
      Throws:
      IllegalArgumentException - 如果别名无对应的枚举,抛出此异常
    • of

      public static Week of(DayOfWeek dayOfWeek)
      DayOfWeek星期相关值转换为Week枚举对象
      Parameters:
      dayOfWeek - DayOfWeek星期值
      Returns:
      Week
      See Also:
    • getName

      public static String getName(int code, String prefix)
      转换为中文名
      Parameters:
      code - Calendar中关于Week的int值,1表示Sunday
      prefix - 表示星期的前缀,例如前缀为“星期”,则返回结果为“星期一”;前缀为”周“,结果为“周一”
      Returns:
      星期的中文名
    • get

      public static String[] get(String fieldName)
      获取枚举属性信息
      Parameters:
      fieldName - 属性名称
      Returns:
      the string[]
    • getCode

      public int getCode()
      获得星期对应Calendar 中的Week值
      Returns:
      星期对应 Calendar 中的Week值
    • getIsoValue

      public int getIsoValue()
      获取ISO8601规范的int值,from 1 (Monday) to 7 (Sunday).
      Returns:
      ISO8601规范的int值
    • getName

      public String getName()
      转换为中文名
      Returns:
      星期的中文名
    • getName

      public String getName(String prefix)
      转换为中文名
      Parameters:
      prefix - 表示星期的前缀,例如前缀为“星期”,则返回结果为“星期一”;前缀为”周“,结果为“周一”
      Returns:
      星期的中文名
    • toJdkDayOfWeek

      public DayOfWeek toJdkDayOfWeek()
      转换为DayOfWeek
      Returns:
      DayOfWeek