With
has been promoted to the main package, so use that one instead.@Target(value={FIELD,TYPE}) @Retention(value=SOURCE) public @interface Wither
Complete documentation is found at the project lombok features page for @Wither.
Even though it is not listed, this annotation also has the onParam
and onMethod
parameter. See the full documentation for more details.
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); }
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 |
---|---|
Wither.AnyAnnotation[] |
onMethod
Deprecated.
Any annotations listed here are put on the generated method.
|
Wither.AnyAnnotation[] |
onParam
Deprecated.
Any annotations listed here are put on the generated method's parameter.
|
AccessLevel |
value
Deprecated.
If you want your wither to be non-public, you can specify an alternate access level here.
|
public abstract AccessLevel value
public abstract Wither.AnyAnnotation[] onMethod
@Wither(onMethod=@__({@AnnotationsGoHere}))
@Wither(onMethod_={@AnnotationsGohere})
// note the underscore after onMethod
.public abstract Wither.AnyAnnotation[] onParam
@Wither(onParam=@__({@AnnotationsGoHere}))
@Wither(onParam_={@AnnotationsGohere})
// note the underscore after onParam
.Copyright © 2024. All rights reserved.