Lombok Builder ignores custom setter

so I have a class with @Builder annotation and a custom installer that should do more than set this.authorities

@Setter(AccessLevel.NONE)
private Collection<Authority> authorities;

public void setAuthorities(Collection<Authority> authorities...

      

but this setter is ignored when using the class builder.

Another weird thing to me is that the builder still has a method authorities

, even if I remove my setter. Is this a bug or am I doing something wrong here?

+3


source to share


1 answer


@Builder

generates its own class classNameBuilder

using methods and fields. This is why it doesn't use your annotation setter @Setter

. These both annotations are independent of each other, so when you removed the setter collector it still works.

See Lombok doc https://projectlombok.org/features/Builder.html



Could you please share your code to make it easier to understand what you want to achieve?

+6


source







All Articles