Enum Class Week
- All Implemented Interfaces:
Serializable,Comparable<Week>,Constable
星期枚举
与Calendar中的星期int值对应
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]获取枚举属性信息intgetCode()获得星期对应Calendar中的Week值int获取ISO8601规范的int值,from 1 (Monday) to 7 (Sunday).getName()转换为中文名static String转换为中文名转换为中文名static Weekof(int code) 将Calendar星期相关值转换为Week枚举对象static Week解析别名为Week对象,别名如:sun或者SUNDAY,不区分大小写static Week将DayOfWeek星期相关值转换为Week枚举对象转换为DayOfWeekstatic WeekReturns the enum constant of this class with the specified name.static Week[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SUNDAY
周日 -
MONDAY
周一 -
TUESDAY
周二 -
WEDNESDAY
周三 -
THURSDAY
周四 -
FRIDAY
周五 -
SATURDAY
周六
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
of
将Calendar星期相关值转换为Week枚举对象- Parameters:
code- Calendar中关于Week的int值,1表示Sunday- Returns:
- Week
- See Also:
-
of
解析别名为Week对象,别名如:sun或者SUNDAY,不区分大小写- Parameters:
name- 别名值- Returns:
- 周枚举Week,非空
- Throws:
IllegalArgumentException- 如果别名无对应的枚举,抛出此异常
-
of
将DayOfWeek星期相关值转换为Week枚举对象- Parameters:
dayOfWeek- DayOfWeek星期值- Returns:
- Week
- See Also:
-
getName
转换为中文名- Parameters:
code- Calendar中关于Week的int值,1表示Sundayprefix- 表示星期的前缀,例如前缀为“星期”,则返回结果为“星期一”;前缀为”周“,结果为“周一”- Returns:
- 星期的中文名
-
get
获取枚举属性信息- 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
转换为中文名- Returns:
- 星期的中文名
-
getName
转换为中文名- Parameters:
prefix- 表示星期的前缀,例如前缀为“星期”,则返回结果为“星期一”;前缀为”周“,结果为“周一”- Returns:
- 星期的中文名
-
toJdkDayOfWeek
转换为DayOfWeek- Returns:
DayOfWeek
-