Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
499 views
in Technique[技术] by (71.8m points)

lombok - Lombook @Data not allowing object to printed if it is extend from collections

I have an object which is extended from an ArrayList. Here is the code:

@Data
@EqualsAndHashCode(callSuper = false)
public class MyObject extends ArrayList<ParentObject>{
   private static final long serialVersionUID = "";
}

ParentObject has some set of fields. While logging this object I get empty object in the logs "MyObject()".

However, if I replace @Data with @Getter and @Setter then it works perfectly and the object is getting printed along with its properties. As per my understanding @Data in a way a collection for all getter, setter, hashcode etc. methods. Is there a way to disable specific methods to identify which of these methods is causing the problem?

I got the code working with @Getter/@Setter but looking for an understanding as to why @Data caused this problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...