@Getter
/ @Setter
public int getFoo() {return foo;}
again.@Getter(lazy=true)
@ToString
toString
for you!@EqualsAndHashCode
Generates
hashCode
and equals
implementations from the fields of your object.
and many others.
01 import lombok.ToString;
02
03 @ToString(exclude="id")
04 public class ToStringExample {
05 private static final int STATIC_VAR = 10;
06 @Getter @Setter(AccessLevel.PROTECTED) private String name;
07 @Getter @Setter private int id;
08
09 }
Not so obvious.
ВідповістиВидалитиIn new version it is impossible to set @Getter or @Setter on fields which also needs other annotations on field's getter or setter methods. So, you'll get perfect spagetti where some fields would have annotated getters and other strictly defined...
Have a nice coding!
It's good choice for some routine classes like dto but obviously it can provoke issue on jpa entity. So sometime it is useful sometime not.
ВідповістиВидалити