Before using lombok, I used the getter / setter generation function of Eclipse.
When migrating from this state to lombok, I was addicted to the methods corresponding to fields like rPoint
.
rPoint
, the method name is different between lombok and Eclipse.For the field sPoint
, Eclipse creates a method calledgetsPoint ()
.
The next character after the prefix get
is lowercase.
TwoCharacter.java
/*Added getter generated by Eclipse function*/
public class TwoCharacter {
private String sPoint = "sPoint";
public String getsPoint() {
return sPoint;
}
}
On the other hand, lombok creates a method called getSPoint ()
.
The next character after the prefix get
is uppercase.
TwoCharacter.java
@Getter
public class TwoCharacter {
private String sPoint = "sPoint";
public void print() {
System.out.println(getSPoint());
}
}
Be careful when the camel case is separated by one character!