diff options
Diffstat (limited to 'usage_examples')
-rw-r--r-- | usage_examples/BuilderExample_post.jpage | 17 | ||||
-rw-r--r-- | usage_examples/BuilderExample_pre.jpage | 1 | ||||
-rw-r--r-- | usage_examples/experimental/varExample_post.jpage | 2 | ||||
-rw-r--r-- | usage_examples/experimental/varExample_pre.jpage | 2 |
4 files changed, 18 insertions, 4 deletions
diff --git a/usage_examples/BuilderExample_post.jpage b/usage_examples/BuilderExample_post.jpage index 54b064d7..0b64703c 100644 --- a/usage_examples/BuilderExample_post.jpage +++ b/usage_examples/BuilderExample_post.jpage @@ -1,6 +1,7 @@ import java.util.Set; public class BuilderExample { + private long created; private String name; private int age; private Set<String> occupations; @@ -11,11 +12,17 @@ public class BuilderExample { this.occupations = occupations; } + private static long $default$created() { + return System.currentTimeMillis(); + } + public static BuilderExampleBuilder builder() { return new BuilderExampleBuilder(); } public static class BuilderExampleBuilder { + private long created; + private boolean created$set; private String name; private int age; private java.util.ArrayList<String> occupations; @@ -23,6 +30,12 @@ public class BuilderExample { BuilderExampleBuilder() { } + public BuilderExampleBuilder created(long created) { + this.created = created; + this.created$set = true; + return this; + } + public BuilderExampleBuilder name(String name) { this.name = name; return this; @@ -63,12 +76,12 @@ public class BuilderExample { // complicated switch statement to produce a compact properly sized immutable set omitted. // go to https://projectlombok.org/features/Singular-snippet.html to see it. Set<String> occupations = ...; - return new BuilderExample(name, age, occupations); + return new BuilderExample(created$set ? created : BuilderExample.$default$created(), name, age, occupations); } @java.lang.Override public String toString() { - return "BuilderExample.BuilderExampleBuilder(name = " + this.name + ", age = " + this.age + ", occupations = " + this.occupations + ")"; + return "BuilderExample.BuilderExampleBuilder(created = " + this.created + ", name = " + this.name + ", age = " + this.age + ", occupations = " + this.occupations + ")"; } } }
\ No newline at end of file diff --git a/usage_examples/BuilderExample_pre.jpage b/usage_examples/BuilderExample_pre.jpage index 1557fff4..3b1b0df2 100644 --- a/usage_examples/BuilderExample_pre.jpage +++ b/usage_examples/BuilderExample_pre.jpage @@ -4,6 +4,7 @@ import java.util.Set; @Builder public class BuilderExample { + @Builder.Default private long created = System.currentTimeMillis(); private String name; private int age; @Singular private Set<String> occupations; diff --git a/usage_examples/experimental/varExample_post.jpage b/usage_examples/experimental/varExample_post.jpage index 41c022d3..d0a7c124 100644 --- a/usage_examples/experimental/varExample_post.jpage +++ b/usage_examples/experimental/varExample_post.jpage @@ -1,7 +1,7 @@ import java.util.ArrayList; import lombok.var; -public class ValExample { +public class VarExample { public String example() { ArrayList<String> example = new ArrayList<String>(); example.add("Hello, World!"); diff --git a/usage_examples/experimental/varExample_pre.jpage b/usage_examples/experimental/varExample_pre.jpage index 0786c0df..e58c4c0d 100644 --- a/usage_examples/experimental/varExample_pre.jpage +++ b/usage_examples/experimental/varExample_pre.jpage @@ -1,7 +1,7 @@ import java.util.ArrayList; import lombok.var; -public class ValExample { +public class VarExample { public String example() { var example = new ArrayList<String>(); example.add("Hello, World!"); |