类 TemporalAccessorParser
- java.lang.Object
- org.springframework.format.datetime.standard.TemporalAccessorParser
- 所有已实现的接口:
Parser<TemporalAccessor>
public final class TemporalAccessorParser extends Object implements Parser<TemporalAccessor>
Parser
implementation for a JSR-310TemporalAccessor
, using aDateTimeFormatter
) (the contextual one, if available).- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller
- 另请参阅:
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)
构造器概要
构造器 构造器 说明 TemporalAccessorParser(Class<? extends TemporalAccessor> temporalAccessorType, DateTimeFormatter formatter)
Create a new TemporalAccessorParser for the given TemporalAccessor type.
构造器详细资料
TemporalAccessorParser
public TemporalAccessorParser(Class<? extends TemporalAccessor> temporalAccessorType, DateTimeFormatter formatter)
Create a new TemporalAccessorParser for the given TemporalAccessor type.- 参数:
temporalAccessorType
- the specific TemporalAccessor class (LocalDate, LocalTime, LocalDateTime, ZonedDateTime, OffsetDateTime, OffsetTime)formatter
- the base DateTimeFormatter instance
方法详细资料
parse
public TemporalAccessor parse(String text, Locale locale) throws ParseException
从接口复制的说明:Parser
Parse a text String to produce a T.- 指定者:
parse
在接口中Parser<TemporalAccessor>
- 参数:
text
- the text stringlocale
- the current user locale- 返回:
- an instance of T
- 抛出:
ParseException
- when a parse exception occurs in a java.text parsing library