Lombok - v0.11.4

lombok.experimental
Annotation Type Wither


@Target(value={FIELD,TYPE})
@Retention(value=SOURCE)
public @interface Wither

Put on any field to make lombok build a 'wither' - a withX method which produces a clone of this object (except for 1 field which gets a new value).

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.


Optional Element Summary
 AccessLevel value
          If you want your wither to be non-public, you can specify an alternate access level here.
 

value

public abstract AccessLevel value
If you want your wither to be non-public, you can specify an alternate access level here.

Default:
lombok.AccessLevel.PUBLIC

Lombok - v0.11.4

Copyright © 2009-2011 The Project Lombok Authors, licensed under the MIT licence.