Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

461
Visualizações
Lombok @Data annotation changes the name of a field from isood to good

I have this DTO which uses @Data annotation of lombok in order to generate getters and setters:

@Data
public class SomeDto {

  protected boolean isGood;
}

The weird thing is that now my getter has been renamed from getisGood() to isGood() and the setter has the name setGood() instead of setIsGood(). Example:

SomeDto somedto = new SomeDto()
somedto.setGood(false) //sets the value to false - should have been setIsGood
somedto.isGood() //return false - should have been getIsGood

Also when I make a request on the endpoint where I use this DTO in the JSON returns:

{"good": false}

whereas is should has been :

{"isGood": false}

Anyone has any idea what the problem is? I have a suspicion that the "is" in the beginning of isGood creates maybe a confusion for lombok. I appreciate any help you can provide.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I guess the convention is that for a boolean, the getter is called isGood, while the setter is setGood. So your boolean is expected to be called just "good".

Here is one discussion

Also in the documentation :)

 lombok.getter.noIsPrefix = [true | false] (default: false)
    If set to true, getters generated for boolean fields will use the get prefix instead of the defaultis prefix, and any generated code that calls getters, such as @ToString, will also use get instead of is 

Docs

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda