[JAVA] Getter names are different in lombok and eclipse for fields like `rPoint`

environment

background

Before using lombok, I used the getter / setter generation function of Eclipse.

image

When migrating from this state to lombok, I was addicted to the methods corresponding to fields like rPoint.

If the camel case is separated by one character like 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());
	}
}

Summary

Be careful when the camel case is separated by one character!

Recommended Posts

Getter names are different in lombok and eclipse for fields like `rPoint`
Use different TransactionManager for metadata and step in spring-batch
Use variables for class and id names in haml