diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-07-09 00:10:36 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-07-09 00:11:00 +0200 |
commit | c1039553b088dc45d272b942d930414d3224b06c (patch) | |
tree | ec303678473bd2c56c711f93dbea464affeaaab3 /test/transform/resource/after-delombok | |
parent | bcf2d55abfb2b9d17de5ec339d16221dca6db6d4 (diff) | |
download | lombok-c1039553b088dc45d272b942d930414d3224b06c.tar.gz lombok-c1039553b088dc45d272b942d930414d3224b06c.tar.bz2 lombok-c1039553b088dc45d272b942d930414d3224b06c.zip |
[builder] added a feature: you can now configure builder class name via the config system
Diffstat (limited to 'test/transform/resource/after-delombok')
-rw-r--r-- | test/transform/resource/after-delombok/BuilderComplex.java | 18 | ||||
-rw-r--r-- | test/transform/resource/after-delombok/BuilderCustomName.java | 47 |
2 files changed, 56 insertions, 9 deletions
diff --git a/test/transform/resource/after-delombok/BuilderComplex.java b/test/transform/resource/after-delombok/BuilderComplex.java index a89d7114..c63d7b59 100644 --- a/test/transform/resource/after-delombok/BuilderComplex.java +++ b/test/transform/resource/after-delombok/BuilderComplex.java @@ -3,7 +3,7 @@ class BuilderComplex { private static <T extends Number> void testVoidWithGenerics(T number, int arg2, String arg3, BuilderComplex selfRef) { } @java.lang.SuppressWarnings("all") - public static class VoidBuilder<T extends Number> { + public static class TestVoidName<T extends Number> { @java.lang.SuppressWarnings("all") private T number; @java.lang.SuppressWarnings("all") @@ -13,25 +13,25 @@ class BuilderComplex { @java.lang.SuppressWarnings("all") private BuilderComplex selfRef; @java.lang.SuppressWarnings("all") - VoidBuilder() { + TestVoidName() { } @java.lang.SuppressWarnings("all") - public VoidBuilder<T> number(final T number) { + public TestVoidName<T> number(final T number) { this.number = number; return this; } @java.lang.SuppressWarnings("all") - public VoidBuilder<T> arg2(final int arg2) { + public TestVoidName<T> arg2(final int arg2) { this.arg2 = arg2; return this; } @java.lang.SuppressWarnings("all") - public VoidBuilder<T> arg3(final String arg3) { + public TestVoidName<T> arg3(final String arg3) { this.arg3 = arg3; return this; } @java.lang.SuppressWarnings("all") - public VoidBuilder<T> selfRef(final BuilderComplex selfRef) { + public TestVoidName<T> selfRef(final BuilderComplex selfRef) { this.selfRef = selfRef; return this; } @@ -42,11 +42,11 @@ class BuilderComplex { @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderComplex.VoidBuilder(number=" + this.number + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ", selfRef=" + this.selfRef + ")"; + return "BuilderComplex.TestVoidName(number=" + this.number + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ", selfRef=" + this.selfRef + ")"; } } @java.lang.SuppressWarnings("all") - public static <T extends Number> VoidBuilder<T> builder() { - return new VoidBuilder<T>(); + public static <T extends Number> TestVoidName<T> builder() { + return new TestVoidName<T>(); } } diff --git a/test/transform/resource/after-delombok/BuilderCustomName.java b/test/transform/resource/after-delombok/BuilderCustomName.java new file mode 100644 index 00000000..4db08220 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderCustomName.java @@ -0,0 +1,47 @@ +import java.util.List; +class BuilderCustomName<T> { + private final int field; + @java.lang.SuppressWarnings("all") + public static abstract class SimpleTestBuilder<T, C extends BuilderCustomName<T>, B extends SimpleTestBuilder<T, C, B>> { + @java.lang.SuppressWarnings("all") + private int field; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.SuppressWarnings("all") + public B field(final int field) { + this.field = field; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderCustomName.SimpleTestBuilder(field=" + this.field + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class SimpleTestBuilderImpl<T> extends SimpleTestBuilder<T, BuilderCustomName<T>, SimpleTestBuilderImpl<T>> { + @java.lang.SuppressWarnings("all") + private SimpleTestBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SimpleTestBuilderImpl<T> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public BuilderCustomName<T> build() { + return new BuilderCustomName<T>(this); + } + } + @java.lang.SuppressWarnings("all") + protected BuilderCustomName(final SimpleTestBuilder<T, ?, ?> b) { + this.field = b.field; + } + @java.lang.SuppressWarnings("all") + public static <T> SimpleTestBuilder<T, ?, ?> builder() { + return new SimpleTestBuilderImpl<T>(); + } +}
\ No newline at end of file |