@Override public JsonValue encode(LocalDateTime value) { String dateString; if (value == null) { dateString = getNullRepresentation(); } else if (getLocaleFromGrid) { if (getParentGrid() == null) { throw new IllegalStateException( "Could not find a locale to format with: " + "this renderer should either be attached to a grid " + "or constructed with locale information"); } dateString = value.format(formatterSupplier.get() .withLocale(getParentGrid().getLocale())); } else { dateString = value.format(formatterSupplier.get()); } return encode(dateString, String.class); }
@Override protected LocalDateTimeRenderer createImplementation() { if (formatter == null) { checkNotNullArgument(formatPattern, "Format pattern may not be null"); checkNotNullArgument(locale, "Locale may not be null"); formatter = DateTimeFormatter.ofPattern(formatPattern, locale); } return new LocalDateTimeRenderer(formatter, getNullRepresentation()); }