根据com.fasterxml.jackson.annotation.JsonIgnore的javadoc,目标可以是构造函数
但是我无法理解在构造函数上应用它的必要性,即
public static class EventTimestamp implements Comparable<EventTimestamp>{
private static final Long ZERO = new Long(0);
private Long milliseconds;
private Long nanoseconds;
public EventTimestamp() {
this(System.currentTimeMillis(), System.nanoTime() % 1_000_000_000);
}
@JsonIgnore
public EventTimestamp(long milliseconds) {
this(milliseconds, 0L);
}
这是错误的例子吗?