diff options
author | Roel Spilker <r.spilker@gmail.com> | 2019-09-12 22:06:02 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2019-09-12 22:06:02 +0200 |
commit | 1260297f73c043a90697675624e2b45203b53dbe (patch) | |
tree | c2e498a910bae475b5d6f22969c1bd0eb434534f /website/usageExamples | |
parent | 80c1b2d2e767f92743b965e3735472e8420848bf (diff) | |
download | lombok-1260297f73c043a90697675624e2b45203b53dbe.tar.gz lombok-1260297f73c043a90697675624e2b45203b53dbe.tar.bz2 lombok-1260297f73c043a90697675624e2b45203b53dbe.zip |
improve `with` examples
Diffstat (limited to 'website/usageExamples')
-rw-r--r-- | website/usageExamples/WithExample_post.jpage | 10 | ||||
-rw-r--r-- | website/usageExamples/WithExample_pre.jpage | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/website/usageExamples/WithExample_post.jpage b/website/usageExamples/WithExample_post.jpage index a881ed8d..c19e26e4 100644 --- a/website/usageExamples/WithExample_post.jpage +++ b/website/usageExamples/WithExample_post.jpage @@ -1,8 +1,8 @@ import lombok.NonNull; public class WithExample { - private final int age; private @NonNull final String name; + private final int age; public WithExample(String name, int age) { if (name == null) throw new NullPointerException(); @@ -10,12 +10,12 @@ public class WithExample { 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); } + + public WithExample withAge(int age) { + return this.age == age ? this : new WithExample(name, age); + } } diff --git a/website/usageExamples/WithExample_pre.jpage b/website/usageExamples/WithExample_pre.jpage index 3c76204e..2f78020a 100644 --- a/website/usageExamples/WithExample_pre.jpage +++ b/website/usageExamples/WithExample_pre.jpage @@ -3,8 +3,8 @@ import lombok.NonNull; import lombok.With; public class WithExample { - @With private final int age; @With(AccessLevel.PROTECTED) @NonNull private final String name; + @With private final int age; public WithExample(String name, int age) { if (name == null) throw new NullPointerException(); |