我有这个注释
@Target(ElementType.METHOD)
@Retention(value = RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@Documented
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Europe/Brussels")
public @interface MyDateFormat {
}
和这个方法:
@MyDateFormat
public LocalDate getCreationDate() {
return Optional.ofNullable(task)
.map(Task::getCreateTime)
.map(date -> date.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate())
.orElse(null);
}
但我得到的是长格式