Class TemporalAccessorParser
java.lang.Object
org.springframework.format.datetime.standard.TemporalAccessorParser
- All Implemented Interfaces:
Parser<TemporalAccessor>
Parser implementation for a JSR-310 TemporalAccessor,
using a DateTimeFormatter (the contextual one, if available).- Since:
- 4.0
- Author:
- Juergen Hoeller, Sam Brannen, Kazuki Shimizu
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTemporalAccessorParser(Class<? extends TemporalAccessor> temporalAccessorType, DateTimeFormatter formatter) Create a new TemporalAccessorParser for the given TemporalAccessor type. -
Method Summary
Modifier and TypeMethodDescriptionParse a text String to produce a T.
-
Constructor Details
-
TemporalAccessorParser
public TemporalAccessorParser(Class<? extends TemporalAccessor> temporalAccessorType, 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 Details
-
parse
Description copied from interface:ParserParse a text String to produce a T.- Specified by:
parsein interfaceParser<TemporalAccessor>- Parameters:
text- the text stringlocale- the current user locale- Returns:
- an instance of T
- Throws:
ParseException- when a parse exception occurs in a java.text parsing library
-