aboutsummaryrefslogtreecommitdiff
path: root/usage_examples/experimental/BuilderExample_post.jpage
diff options
context:
space:
mode:
Diffstat (limited to 'usage_examples/experimental/BuilderExample_post.jpage')
-rw-r--r--usage_examples/experimental/BuilderExample_post.jpage40
1 files changed, 40 insertions, 0 deletions
diff --git a/usage_examples/experimental/BuilderExample_post.jpage b/usage_examples/experimental/BuilderExample_post.jpage
new file mode 100644
index 00000000..624b236b
--- /dev/null
+++ b/usage_examples/experimental/BuilderExample_post.jpage
@@ -0,0 +1,40 @@
+public class BuilderExample {
+ private String name;
+ private int age;
+
+ BuilderExample(String name, int age) {
+ this.name = name;
+ this.age = age;
+ }
+
+ public static BuilderExampleBuilder builder() {
+ return new BuilderExampleBuilder();
+ }
+
+ public static class BuilderExampleBuilder {
+ private String name;
+ private int age;
+
+ BuilderExampleBuilder() {
+ }
+
+ public BuilderExampleBuilder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public BuilderExampleBuilder age(int age) {
+ this.age = age;
+ return this;
+ }
+
+ public BuilderExample build() {
+ return new BuilderExample(name, age);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return "BuilderExample.BuilderExampleBuilder(name = " + this.name + ", age = " + this.age + ")";
+ }
+ }
+} \ No newline at end of file