Lombok helps generate setters and getters.Is there anyway to autogenerate hasAttributeValue check in spring?

Viewed 144

Lombok plugin helps auto generate getter and setter functions for a class attributes.

class User {
String firstName;
String lastName;

}

I have a need to add the empty check for the String attributes

public boolean hasFirstName() {
   return StringUtils.isEmpty(this.firstName)
}

public boolean hasSecondName() {
  return StringUtils.isEmpty(this.secondName);
}

I am looking for any possible way to autogenerate these has Value functions?

0 Answers
Related