public class LocalTimeStringConverter
extends <any>
StringConverter
implementation for LocalTime
values.
LocalDateStringConverter
,
LocalDateTimeStringConverter
Modifier and Type | Field and Description |
---|---|
(package private) LocalDateTimeStringConverter.LdtConverter<java.time.LocalTime> |
ldtConverter |
Constructor and Description |
---|
LocalTimeStringConverter()
Create a
StringConverter for LocalTime values, using a
default formatter and parser with FormatStyle.SHORT , and the
user's Locale . |
LocalTimeStringConverter(java.time.format.DateTimeFormatter formatter,
java.time.format.DateTimeFormatter parser)
Create a StringConverter for
LocalTime values using the
supplied formatter and parser, which are responsible for
choosing the desired Locale . |
LocalTimeStringConverter(java.time.format.FormatStyle timeStyle)
Create a
StringConverter for LocalTime values, using a
default formatter and parser with the specified FormatStyle and
based on the user's Locale . |
LocalTimeStringConverter(java.time.format.FormatStyle timeStyle,
java.util.Locale locale)
Create a StringConverter for
LocalTime values, using a
default formatter and parser with the specified FormatStyle
and Locale . |
Modifier and Type | Method and Description |
---|---|
java.time.LocalTime |
fromString(java.lang.String value) |
java.lang.String |
toString(java.time.LocalTime value) |
LocalDateTimeStringConverter.LdtConverter<java.time.LocalTime> ldtConverter
public LocalTimeStringConverter()
StringConverter
for LocalTime
values, using a
default formatter and parser with FormatStyle.SHORT
, and the
user's Locale
.public LocalTimeStringConverter(java.time.format.FormatStyle timeStyle)
StringConverter
for LocalTime
values, using a
default formatter and parser with the specified FormatStyle
and
based on the user's Locale
.timeStyle
- The FormatStyle
that will be used by the default
formatter and parser. If null then FormatStyle.SHORT
will be used.public LocalTimeStringConverter(java.time.format.FormatStyle timeStyle, java.util.Locale locale)
LocalTime
values, using a
default formatter and parser with the specified FormatStyle
and Locale
.timeStyle
- The FormatStyle
that will be used by the default
formatter and parser. If null then FormatStyle.SHORT
will be used.locale
- The Locale
that will be used by the default
formatter and parser. If null then
Locale.getDefault(Locale.Category.FORMAT)
will be used.public LocalTimeStringConverter(java.time.format.DateTimeFormatter formatter, java.time.format.DateTimeFormatter parser)
LocalTime
values using the
supplied formatter and parser, which are responsible for
choosing the desired Locale
.
For example, a fixed pattern can be used for converting both ways:
String pattern = "HH:mm:ss"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); StringConverter<LocalTime> converter = DateTimeStringConverter.getLocalTimeConverter(formatter, null);
formatter
- An instance of DateTimeFormatter
which
will be used for formatting by the toString() method. If null
then a default formatter will be used.parser
- An instance of DateTimeFormatter
which
will be used for parsing by the fromString() method. This can
be identical to formatter. If null, then formatter will be
used, and if that is also null, then a default parser will be
used.