Spring MillisecondInstantPrinter

  • 类全路径: org.springframework.format.datetime.joda.MillisecondInstantPrinter
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
public final class MillisecondInstantPrinter implements Printer<Long> {

	private final DateTimeFormatter formatter;


	/**
	 * Create a new ReadableInstantPrinter.
	 * @param formatter the Joda DateTimeFormatter instance
	 */
	public MillisecondInstantPrinter(DateTimeFormatter formatter) {
		this.formatter = formatter;
	}


	@Override
	public String print(Long instant, Locale locale) {
		// DateTimeFormatter .print
		return JodaTimeContextHolder.getFormatter(this.formatter, locale).print(instant);
	}

}