[With] updated documentation for Wither/With

This commit is contained in:
Reinier Zwitserloot committed 2019-08-27 00:15:47 +02:00
1 parent 461b5541da
commit da5d9a12e7
8 files changed
+90 -101

No files matched your search

@@ -0,0 +1,21 @@
import lombok.NonNull;
public class WithExample {
private final int age;
private @NonNull final String name;
public WithExample(String name, int age) {
if (name == null) throw new NullPointerException();
this.name = name;
this.age = age;
}
public WithExample withAge(int age) {
return this.age == age ? this : new WithExample(name, age);
}
protected WithExample withName(@NonNull String name) {
if (name == null) throw new java.lang.NullPointerException("name");
return this.name == name ? this : new WithExample(name, age);
}
}