Package org.apache.calcite.avatica.util
Enum TimeUnit
- All Implemented Interfaces:
Serializable,Comparable<TimeUnit>,java.lang.constant.Constable
Enumeration of time units used to construct an interval.
Only YEAR, MONTH, DAY,
HOUR, MINUTE, SECOND can be the unit of a SQL
interval.
The others (QUARTER, WEEK, MILLISECOND,
DOW, DOY, EPOCH, DECADE, CENTURY,
MILLENNIUM, MICROSECOND, NANOSECOND, ISODOW
and ISOYEAR) are convenient to use internally,
when converting to and from UNIX timestamps.
And also may be arguments to the EXTRACT, TIMESTAMPADD and
TIMESTAMPDIFF functions.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic TimeUnitgetValue(int ordinal) Returns the TimeUnit associated with an ordinal.booleanisValidValue(BigDecimal field) Returns whether a given value is valid for a field of this time unit.static TimeUnitReturns the enum constant of this type with the specified name.static TimeUnit[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
YEAR
-
MONTH
-
DAY
-
HOUR
-
MINUTE
-
SECOND
-
QUARTER
-
ISOYEAR
-
WEEK
-
MILLISECOND
-
MICROSECOND
-
NANOSECOND
-
DOW
-
ISODOW
-
DOY
-
EPOCH
-
DECADE
-
CENTURY
-
MILLENNIUM
-
-
Field Details
-
yearMonth
public final boolean yearMonth -
separator
public final char separator -
multiplier
-
-
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:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getValue
Returns the TimeUnit associated with an ordinal. The value returned is null if the ordinal is not a member of the TimeUnit enumeration. -
isValidValue
Returns whether a given value is valid for a field of this time unit.- Parameters:
field- Field value- Returns:
- Whether value
-