public final class TemporalAccessorParser extends java.lang.Object implements Parser<java.time.temporal.TemporalAccessor>
Parser
implementation for a JSR-310 TemporalAccessor
,
using a DateTimeFormatter
) (the contextual one, if available).DateTimeContextHolder.getFormatter(java.time.format.DateTimeFormatter, java.util.Locale)
,
LocalDate.parse(CharSequence, java.time.format.DateTimeFormatter)
,
LocalTime.parse(CharSequence, java.time.format.DateTimeFormatter)
,
LocalDateTime.parse(CharSequence, java.time.format.DateTimeFormatter)
,
ZonedDateTime.parse(CharSequence, java.time.format.DateTimeFormatter)
,
OffsetDateTime.parse(CharSequence, java.time.format.DateTimeFormatter)
,
OffsetTime.parse(CharSequence, java.time.format.DateTimeFormatter)
Constructor and Description |
---|
TemporalAccessorParser(java.lang.Class<? extends java.time.temporal.TemporalAccessor> temporalAccessorType,
java.time.format.DateTimeFormatter formatter)
Create a new TemporalAccessorParser for the given TemporalAccessor type.
|
Modifier and Type | Method and Description |
---|---|
java.time.temporal.TemporalAccessor |
parse(java.lang.String text,
java.util.Locale locale)
Parse a text String to produce a T.
|
public TemporalAccessorParser(java.lang.Class<? extends java.time.temporal.TemporalAccessor> temporalAccessorType, java.time.format.DateTimeFormatter formatter)
temporalAccessorType
- the specific TemporalAccessor class
(LocalDate, LocalTime, LocalDateTime, ZonedDateTime, OffsetDateTime, OffsetTime)formatter
- the base DateTimeFormatter instancepublic java.time.temporal.TemporalAccessor parse(java.lang.String text, java.util.Locale locale) throws java.text.ParseException
Parser