Top Description Constructors Methods
org.springframework.format.datetime.standard

public Class InstantFormatter

extends Object
implements Formatter<Instant>
Class Inheritance
All Implemented Interfaces
org.springframework.format.Formatter, org.springframework.format.Parser, org.springframework.format.Printer
Imports
java.text.ParseException, java.time.Instant, java.time.format.DateTimeFormatter, java.util.Locale, org.springframework.format.Formatter

Formatter implementation for a JSR-310 java.time.Instant, following JSR-310's parsing rules for an Instant (that is, not using a configurable java.time.format.DateTimeFormatter): accepting the default ISO_INSTANT format as well as RFC_1123_DATE_TIME (which is commonly used for HTTP date header values), as of Spring 4.3.
Authors
Juergen Hoeller, Andrei Nevedomskii
Since
4.0
See Also
java.time.Instant#parse, java.time.format.DateTimeFormatter#ISO_INSTANT, java.time.format.DateTimeFormatter#RFC_1123_DATE_TIME

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Instant
parse(String
the text string
text
,
Locale
the current user locale
locale
)

Implements org.springframework.format.Parser.parse.

Parse a text String to produce a T.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

InstantFormatterback to summary
public InstantFormatter()

Method Detail

parseback to summary
public Instant parse(String text, Locale locale) throws ParseException

Implements org.springframework.format.Parser.parse.

Doc from org.springframework.format.Parser.parse.

Parse a text String to produce a T.

Parameters
text:String

the text string

locale:Locale

the current user locale

Returns:Instant

an instance of T

Annotations
@Override
Exceptions
ParseException:
when a parse exception occurs in a java.text parsing library