kavetiraviteja
kavetiraviteja

Reputation: 2208

Customised Setter and Getter in Lombok

Lombok @Data annotation will dumbly add setter and getter of fields on the annotated class.

how to add condition based setter in lombok?

public void setName(final String name){
      this.name = StringUtils.trimToEmpty(name);
}

is there any support in lombok like this @Setter(condition = StringUtils.isEmpty)

i have searched in lombok doc's i see no explanation regarding my issue.

Upvotes: 3

Views: 11677

Answers (1)

Mobility
Mobility

Reputation: 3305

you can just add another setter, it will override lombok's implenmention

Upvotes: 3

Related Questions