Class InstantFormatter
- java.lang.Object
- org.springframework.format.datetime.standard.InstantFormatter
public class InstantFormatter extends Object implements Formatter<Instant>
Formatterimplementation for a JSR-310Instant, following JSR-310's parsing rules for an Instant (that is, not using a configurableDateTimeFormatter): accepting the defaultISO_INSTANTformat as well asRFC_1123_DATE_TIME(which is commonly used for HTTP date header values), as of Spring 4.3.- Since:
- 4.0
- Author:
- Juergen Hoeller, Andrei Nevedomskii
- See Also:
Instant.parse(java.lang.CharSequence),DateTimeFormatter.ISO_INSTANT,DateTimeFormatter.RFC_1123_DATE_TIME
Constructor Summary
Constructors Constructor Description InstantFormatter()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Instantparse(String text, Locale locale)Parse a text String to produce a T.Stringprint(Instant object, Locale locale)Print the object of type T for display.
Constructor Detail
InstantFormatter
public InstantFormatter()
Method Detail
parse
public Instant parse(String text, Locale locale) throws ParseException
Description copied from interface:ParserParse a text String to produce a T.- Specified by:
parsein interfaceParser<Instant>- 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