lombok.Data Boolean type value could not be taken and was at a loss

lombok2.png

The version of lombok at the time of writing the article is 1.18.8. @Lombok is a Java library that automatically connects with editors and build tools to spice up your Java (with flavor).

Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more.

Quoted from Official Page In short, it is a library that automatically generates getters, setters, and equals. However, because it does various things automatically It will be a problem if you make exceptional movements.

"Boolean variable name has been rewritten without permission" "Why isn't a Getter made!" I was misunderstood and filled my head with spices. When generating getters / setters with Lombok Data Note that the naming method seems to be slightly different for boolean type. I wrote it instead of a memo.

@data
TestDao
{
boolean isExhausted;//getExhausted()Not isExhausted()You can create a method called.@Even if you install a getter, you cannot get 〇〇.
boolean exhausted;//Is is automatically given and isExhausted()You can getter.
}

Summary ・ In lombok, it seems that you don't want to make a getter called get〇〇 with boolean type. -When the acquired data is returned in JSON format, if is is at the beginning of the variable name, this is has been removed for some reason. -If you really want to add "is" at the beginning and return with Key name in JSON format, put @JsonProperty ("isExhausted") immediately before. -If you create a method such as Get 〇 〇 () by yourself because it is not generated, it will be ignored when data is acquired by the romper (isn't a setter created?). ← It fits here.

It was around this time that I felt that I shouldn't move things forward by speculation.

Recommended Posts

lombok.Data Boolean type value could not be taken and was at a loss
Docker error: service must be a mapping, not a None Type.