aboutsummaryrefslogtreecommitdiff
path: root/usage_examples/experimental
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2013-06-18 04:23:15 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2013-06-18 04:23:15 +0200
commite1c39bbc601408decb0ae147d181708a5af41307 (patch)
treef3a620da1778ae4b9654433bec65841a95ff5067 /usage_examples/experimental
parenteb3d32c718d9ef46fd30bc677147cda85318fb9c (diff)
downloadlombok-e1c39bbc601408decb0ae147d181708a5af41307.tar.gz
lombok-e1c39bbc601408decb0ae147d181708a5af41307.tar.bz2
lombok-e1c39bbc601408decb0ae147d181708a5af41307.zip
javac builder implementation. Passes all tests.
Added toString() impl for builders in both eclipse and javac. Added all documentation, though it'll need some reviewing.
Diffstat (limited to 'usage_examples/experimental')
-rw-r--r--usage_examples/experimental/BuilderExample_post.jpage40
-rw-r--r--usage_examples/experimental/BuilderExample_pre.jpage7
2 files changed, 47 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
diff --git a/usage_examples/experimental/BuilderExample_pre.jpage b/usage_examples/experimental/BuilderExample_pre.jpage
new file mode 100644
index 00000000..9c754352
--- /dev/null
+++ b/usage_examples/experimental/BuilderExample_pre.jpage
@@ -0,0 +1,7 @@
+import lombok.experimental.Builder;
+
+@Builder
+public class BuilderExample {
+ private String name;
+ private int age;
+}