org.springframework.format.datetime.standard

## Class TemporalAccessorParser

- java.lang.Object
- - org.springframework.format.datetime.standard.TemporalAccessorParser

- All Implemented Interfaces:
    Parser<java.time.temporal.TemporalAccessor>

      public final class TemporalAccessorParser
      extends Object
      implements Parser<java.time.temporal.TemporalAccessor>

  `Parser` implementation for a JSR-310 `TemporalAccessor`, using a `DateTimeFormatter`) (the contextual one, if available).
  Since:
    4.0
  Author:
    Juergen Hoeller
  See Also:
    `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 Summary

    Constructors
    Constructor and Description
    `TemporalAccessorParser(Class<? extends java.time.temporal.TemporalAccessor> temporalAccessorType, java.time.format.DateTimeFormatter formatter)` Create a new TemporalAccessorParser for the given TemporalAccessor type.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.time.temporal.TemporalAccessor` | `parse(String text, Locale locale)` Parse a text String to produce a T.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TemporalAccessorParser

          public TemporalAccessorParser(Class<? extends java.time.temporal.TemporalAccessor> temporalAccessorType,
                                        java.time.format.DateTimeFormatter formatter)

      Create a new TemporalAccessorParser for the given TemporalAccessor type.
      Parameters:
        `temporalAccessorType` - the specific TemporalAccessor class (LocalDate, LocalTime, LocalDateTime, ZonedDateTime, OffsetDateTime, OffsetTime)
        `formatter` - the base DateTimeFormatter instance

  - ### Method Detail

    - #### parse

          public java.time.temporal.TemporalAccessor parse(String text,
                                                           Locale locale)
                                                    throws ParseException

      Description copied from interface: `Parser`
      Parse a text String to produce a T.
      Specified by:
        `parse` in interface `Parser<java.time.temporal.TemporalAccessor>`
      Parameters:
        `text` - the text string
        `locale` - the current user locale
      Returns:
        an instance of T
      Throws:
        `ParseException` - when a parse exception occurs in a java.text parsing library