Add method for lists with lombok

I am currently replacing all my standard POJO's to use Lombok for all the boilerplate code.

So far no problems have occurred, but what i'm missing in the lombok implementation is that there are no generated methods for adding one object to a collection.

Generated Code:

private List<Object> list = new ArrayList<>();

public Object getObject(){..}

public void setObject(List<Object> o){..}

What I want extra:

public void addObject(Object o) {..}

Anyone know if this is getting there soon or if this is impossible?


This is surely currently impossible. There's such a proposal, but low priority (or even rejected).

Actually, I can't find it anymore. You may want to try yourself on the issue list.

Now, I stumbled upon this thread showing an interesting workaround limited to a single variable.

链接地址: http://www.djcxy.com/p/77492.html

上一篇: link rel =“pingback”的目的是什么?

下一篇: 用lombok添加列表方法