Java Lombok:在@AllArgsConstructor中省略一个字段? [英] Java Lombok: Omitting one field in @AllArgsConstructor?
本文介绍了Java Lombok:在@AllArgsConstructor中省略一个字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我使用 Lombok 指定 @AllArgsConstructor ,它将生成一个构造函数,用于设置所有声明的(非最终的,非静态的)字段。
是否可以省略某些字段,并为所有其他字段留下生成的构造函数?
If I specify @AllArgsConstructor using Lombok, it will generate a constructor for setting all the declared (not final, not static) fields. Is it possible to omit some field and this leave generated constructor for all other fields?
推荐答案
不,这不是可能。有一个功能请求可以创建@SomeArgsConstructor,您可以在其中指定所涉及字段的列表。
No that is not possible. There is a feature request to create a @SomeArgsConstructor where you can specify a list of involved fields.
完全披露:我是核心Project Lombok开发人员之一。
Full disclosure: I am one of the core Project Lombok developers.
这篇关于Java Lombok:在@AllArgsConstructor中省略一个字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文