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

Categories

0 votes
477 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 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...