Class TemporalAccessorPrinter
- java.lang.Object
- org.springframework.format.datetime.standard.TemporalAccessorPrinter
- All Implemented Interfaces:
Printer<TemporalAccessor>
public final class TemporalAccessorPrinter extends Object implements Printer<TemporalAccessor>
Printer
implementation for a JSR-310TemporalAccessor
, using aDateTimeFormatter
) (the contextual one, if available).- Since:
- 4.0
- Author:
- Juergen Hoeller
- See Also:
DateTimeContextHolder.getFormatter(java.time.format.DateTimeFormatter, java.util.Locale)
,DateTimeFormatter.format(java.time.temporal.TemporalAccessor)
Constructor Summary
Constructors Constructor Description TemporalAccessorPrinter(DateTimeFormatter formatter)
Create a new TemporalAccessorPrinter.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
print(TemporalAccessor partial, Locale locale)
Print the object of type T for display.
Constructor Detail
TemporalAccessorPrinter
public TemporalAccessorPrinter(DateTimeFormatter formatter)
Create a new TemporalAccessorPrinter.- Parameters:
formatter
- the base DateTimeFormatter instance
Method Detail
print
public String print(TemporalAccessor partial, Locale locale)
Description copied from interface:Printer
Print the object of type T for display.- Specified by:
print
in interfacePrinter<TemporalAccessor>
- Parameters:
partial
- the instance to printlocale
- the current user locale- Returns:
- the printed text string