diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-06-18 04:23:15 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-06-18 04:23:15 +0200 |
commit | e1c39bbc601408decb0ae147d181708a5af41307 (patch) | |
tree | f3a620da1778ae4b9654433bec65841a95ff5067 /usage_examples/experimental | |
parent | eb3d32c718d9ef46fd30bc677147cda85318fb9c (diff) | |
download | lombok-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.jpage | 40 | ||||
-rw-r--r-- | usage_examples/experimental/BuilderExample_pre.jpage | 7 |
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; +} |