public interface InstantFormatter
Instant objects.
This interface provides the main entry point for print and parsing and provides factories for the
available implementations of InstantFormatter.
The patterns that are supported and their behavior depend on the underlying implementation of the interface.
Implementations of the interface are not meant to be thread safe.
| Modifier and Type | Interface and Description |
|---|---|
static class |
InstantFormatter.Type
Types for the built-in formatter implementations.
|
| Modifier and Type | Method and Description |
|---|---|
String |
format(Instant instant)
Formats the specified instant using the formatters default pattern.
|
String |
format(Instant instant,
String pattern)
Formats the specified instant using the specified pattern.
|
static InstantFormatter |
ofConfiguration(org.apache.hadoop.conf.Configuration conf)
Creates a formatter using the specified configuration.
|
Instant |
parse(String text)
Parses the input text and converts it to an instant.
|
Instant |
parse(String text,
String pattern)
Parses the input text and converts it to an instant using the specified pattern.
|
static InstantFormatter ofConfiguration(org.apache.hadoop.conf.Configuration conf)
conf - the configuration to use, not nullInstant parse(String text) throws RuntimeException
text - the text to parse, not nullRuntimeException - if unable to parse the requested text using the default behavior.Instant parse(String text, String pattern) throws RuntimeException
text - the text to parse, not nullpattern - the pattern to use to parse the text and resolve it to an instantRuntimeException - if unable to parse the requested text using the specified pattern.String format(Instant instant)
This formats the instant to a String using the rules of the underlying formatter.
instant - the instant to formatString format(Instant instant, String pattern)
This formats the instant to a String using specified pattern and the rules of the underlying formatter.
instant - the instant to formatpattern - the pattern to use for formattingCopyright © 2024 The Apache Software Foundation. All rights reserved.