Lombok: Feature Request: Add @NoSetter annotation

Created on 17 Oct 2016  路  1Comment  路  Source: projectlombok/lombok

Right now, if you want to set setters for attributes in a class
you can
a) write @Setter above the class or
b) write @Setter above every attribute that you think should have one, individually.

I suggest you add @NoSetter to make it possible to simplify the coding if you only want one attribute not to have a setter.

//current:

@Getter
...
public class PrivateCustomer extends AbstractCustomer {

private long id;

@Setter
private String name;

@Setter
private String email;
}


//new:

@Getter
@Setter
...
public class PrivateCustomer extends AbstractCustomer {

@NoSetter
private long id;

private String name;

private String email;
}

Most helpful comment

Use @Setter(AccessLevel=NONE) on the field.

>All comments

Use @Setter(AccessLevel=NONE) on the field.

Was this page helpful?
0 / 5 - 0 ratings