@IgnoreJRERequirement public final class PreciseTimestampFormatter extends Object implements TimestampFormatter
DateTimeFormatter
with nanosecond precision. The last formatted timestamp
will be cached, if the formatter does neither output nanoseconds nor microseconds.Constructor and Description |
---|
PreciseTimestampFormatter(String pattern,
Locale locale) |
Modifier and Type | Method and Description |
---|---|
String |
format(Timestamp timestamp)
Formats a timestamp.
|
boolean |
isValid(String timestamp)
Checks whether a formatted timestamp is compatible with the pattern of this formatter.
|
public PreciseTimestampFormatter(String pattern, Locale locale)
pattern
- Format pattern that is compatible with DateTimeFormatter
locale
- Locale for formattingpublic boolean isValid(String timestamp)
TimestampFormatter
isValid
in interface TimestampFormatter
timestamp
- Formatted timestamptrue
if the given timestamp is compatible with the pattern of this formatter, false
if
notpublic String format(Timestamp timestamp)
TimestampFormatter
format
in interface TimestampFormatter
timestamp
- Timestamp to formatCopyright © 2024. All rights reserved.