Lombok, use only getter setter not equals or tostring [closed]

别等时光非礼了梦想. 提交于 2019-12-04 05:43:17

问题


Because we dont use tostring or equals and it reduces coverage.

So we need to disable lombok for tostring, equals

Is there any way?

For getter

@Getter(AccessLevel.NONE)

i can do this but for others, what can i do?

And as i understood,

@lombok.Accessors(chain = true, fluent = true)

this is also for getter setter


回答1:


I don't know what you're using for coverage, but we have enabled a lombok setting that prevents it from affecting our coverage. Create a lombok.config file at the top level of your project with this:

config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true

The first line is optional; it just tells lombok to stop searching for other config files. The second line causes lombok to add an annotation to the methods it creates marking them as being lombok generated. For the coverage tool we use, jacoco, that prevents it from taking these methods into consideration when calculating the coverage.




回答2:


If I understand your question correctly, this should do it.

@Setter
@Getter
public class SomeClass {
...
}


来源:https://stackoverflow.com/questions/52667771/lombok-use-only-getter-setter-not-equals-or-tostring

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!