@Target(value={FIELD,TYPE}) @Retention(value=SOURCE) public @interface Wither
Example:
private @Wither final int foo;
will generate:
public SELF_TYPE withFoo(int foo) {
return this.foo == foo ? this : new SELF_TYPE(otherField1, otherField2, foo);
}
If any method named withFoo (case insensitive) exists, regardless of return type or parameters,
no method is generated, and instead a compiler warning is emitted.
This annotation can also be applied to a class, in which case it'll be as if all non-static fields that don't already have
a Wither annotation have the annotation.
| Modifier and Type | Optional Element and Description |
|---|---|
AccessLevel |
value
If you want your wither to be non-public, you can specify an alternate access level here.
|
public abstract AccessLevel value
Copyright © 2009-2011 The Project Lombok Authors, licensed under the MIT licence.