List of usage examples for org.springframework.format.datetime.joda ReadablePartialPrinter ReadablePartialPrinter
public ReadablePartialPrinter(DateTimeFormatter formatter)
From source file:cherry.foundation.type.format.CustomDateTimeFormatAnnotationFormatterFactory.java
@Override public Printer<?> getPrinter(CustomDateTimeFormat annotation, Class<?> fieldType) { if (fieldType == LocalDate.class) { DateTimeFormatterBuilder toPrint = builder(dateToPrint); return new ReadablePartialPrinter(toPrint.toFormatter()); } else if (fieldType == LocalTime.class) { DateTimeFormatterBuilder toPrint = builder(timeToPrint); return new ReadablePartialPrinter(toPrint.toFormatter()); } else if (fieldType == LocalDateTime.class) { DateTimeFormatterBuilder toPrint = builder(dateToPrint).appendPattern(delimiterToPrint) .appendPattern(timeToPrint); return new ReadablePartialPrinter(toPrint.toFormatter()); } else if (fieldType == DateTime.class) { DateTimeFormatterBuilder toPrint = builder(dateToPrint).appendPattern(delimiterToPrint) .appendPattern(timeToPrint); return new ReadableInstantPrinter(toPrint.toFormatter()); } else {/*from w ww. j a v a2s . co m*/ throw new IllegalStateException(); } }