Enum Class TimeFormat
- All Implemented Interfaces:
Serializable, Comparable<TimeFormat>, Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCompact format such as"1d 2h 3m 4s"omitting milliseconds.Compact format that includes milliseconds, e.g.Debug output including all units down to nanoseconds.Digital clock-style formatting such as"01:22:05".Digital formatting including milliseconds such as"00:10.532".ISO-8601 duration format, such as"PT30S"or"P2DT3H".Returns only the largest non-zero component, e.g.Returns the first two non-zero components, e.g.Verbose English format, e.g.Verbose format without a conjunction, e.g. -
Method Summary
Modifier and TypeMethodDescriptionabstract Stringapply(long nanos) Converts a nanosecond duration into a formatted string.static TimeFormatReturns the enum constant of this class with the specified name.static TimeFormat[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
COMPACT
Compact format such as"1d 2h 3m 4s"omitting milliseconds. -
COMPACT_MILLIS
Compact format that includes milliseconds, e.g."3s 250ms". -
VERBOSE
Verbose English format, e.g."2 days, 3 hours and 4 minutes". -
VERBOSE_SIMPLE
Verbose format without a conjunction, e.g."2 days, 3 hours, 4 minutes". -
DIGITAL
Digital clock-style formatting such as"01:22:05". -
DIGITAL_MILLIS
Digital formatting including milliseconds such as"00:10.532". -
MINIMAL
Returns only the largest non-zero component, e.g."3h"or"20m". -
MINIMAL_TWO
Returns the first two non-zero components, e.g."3h 20m". -
ISO_8601
ISO-8601 duration format, such as"PT30S"or"P2DT3H". -
DEBUG
Debug output including all units down to nanoseconds.
-
-
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
-
apply
Converts a nanosecond duration into a formatted string.- Parameters:
nanos- duration in nanoseconds- Returns:
- formatted representation of the duration
-