Enum InstantNumberFormatter
java.lang.Object
java.lang.Enum<InstantNumberFormatter>
org.apache.logging.log4j.core.util.internal.instant.InstantNumberFormatter
- All Implemented Interfaces:
Serializable
,Comparable<InstantNumberFormatter>
,InstantFormatter
Formats an
Instant
numerically; e.g., formats its epoch1 seconds.
1 Epoch is a fixed instant on 1970-01-01Z
.
Internal usage only!
This class is intended only for internal Log4j usage. Log4j users should not use this class! This class is not subject to any backward compatibility concerns.
- Since:
- 2.25.0
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionFormats milliseconds since epoch, including the nanosecond fraction; e.g.,1581082727982.123456
.Formats the nanosecond fraction of milliseconds since epoch; e.g.,123456
.Formats milliseconds since epoch, excluding the nanosecond fraction; e.g.,1581082727982
.Formats nanoseconds since epoch; e.g.,1581082727982123456
.Formats seconds since epoch, including the nanosecond fraction; e.g.,1581082727.982123456
.Formats the nanosecond fraction of seconds since epoch; e.g.,982123456
.Formats seconds since epoch, excluding the nanosecond fraction; e.g.,1581082727
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
formatTo
(StringBuilder buffer, Instant instant) static InstantNumberFormatter
Returns the enum constant of this type with the specified name.static InstantNumberFormatter[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Methods inherited from interface org.apache.logging.log4j.core.util.internal.instant.InstantFormatter
format
-
Enum Constant Details
-
EPOCH_NANOS
Formats nanoseconds since epoch; e.g.,1581082727982123456
. -
EPOCH_MILLIS
Formats milliseconds since epoch, including the nanosecond fraction; e.g.,1581082727982.123456
. The nanosecond fraction will be skipped if it is zero. -
EPOCH_MILLIS_ROUNDED
Formats milliseconds since epoch, excluding the nanosecond fraction; e.g.,1581082727982
. -
EPOCH_MILLIS_NANOS
Formats the nanosecond fraction of milliseconds since epoch; e.g.,123456
. -
EPOCH_SECONDS
Formats seconds since epoch, including the nanosecond fraction; e.g.,1581082727.982123456
. The nanosecond fraction will be skipped if it is zero. -
EPOCH_SECONDS_ROUNDED
Formats seconds since epoch, excluding the nanosecond fraction; e.g.,1581082727
. The nanosecond fraction will be skipped if it is zero. -
EPOCH_SECONDS_NANOS
Formats the nanosecond fraction of seconds since epoch; e.g.,982123456
.
-
-
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
-
getPrecision
- Specified by:
getPrecision
in interfaceInstantFormatter
- Returns:
- the time precision of the formatted output
-
formatTo
- Specified by:
formatTo
in interfaceInstantFormatter
-