编辑具有前缀“has”的布尔成员的lombok getter方法名称
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了编辑具有前缀“has”的布尔成员的lombok getter方法名称相关的知识,希望对你有一定的参考价值。
我在lombok中有一个布尔变量hasObject
,它生成isHasObject()
。我正在使用@Data
lombok注释。如何将方法更改为hasObject()
在你的情况下,它可能是:
class XY : Object {
@Getter(fluent = true)
public boolean hasObject;
}
要么
@Accessors(fluent = true)
class XY : Object {
public boolean hasObject;
}
根据文件:
流利 - 布尔值。如果是真的,辣椒的吸气剂只是胡椒(),而产品是辣椒(T newValue)。此外,除非指定,否则链默认为true。默认值:false。
我从lombok-how-to-customise-getter-for-boolean-object-field找到了帮助。通过这个我将改变访问器级别和代码getter旧时尚,
@Getter(AccessLevel.NONE) private boolean hasObject;
public boolean hasObject() {
return hasObject;
}
我将保持这个问题的开放性。这是改变getter方法名称的唯一方法,或者我会等待更好的建议。
以上是关于编辑具有前缀“has”的布尔成员的lombok getter方法名称的主要内容,如果未能解决你的问题,请参考以下文章
常见的问题系列---java: You aren’t using a compiler supported by lombok, so lombok will not work and has be
java: You aren‘t using a compiler supported by lombok, so lombok will not work and has been disabled
java: You aren‘t using a compiler supported by lombok, so lombok will not work and has been disabled