aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/before
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-10-08 15:52:43 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-10-08 15:52:43 +0200
commit06455de367932e93da707b9d91e1a347d0c072a6 (patch)
tree46dad85a25c6b8b7959dc2aeecf3f30060b703e1 /test/transform/resource/before
parent3bb6f69a5b03ac3181f5bd6a04050ba339c7642e (diff)
parentbd494bb5ff01eea2413cfe5a4820bfff34c07261 (diff)
downloadlombok-06455de367932e93da707b9d91e1a347d0c072a6.tar.gz
lombok-06455de367932e93da707b9d91e1a347d0c072a6.tar.bz2
lombok-06455de367932e93da707b9d91e1a347d0c072a6.zip
Merge branch 'superToBuilder' of git://github.com/janrieke/lombok into janrieke-superToBuilder
Diffstat (limited to 'test/transform/resource/before')
-rw-r--r--test/transform/resource/before/SuperBuilderAbstractToBuilder.java20
-rw-r--r--test/transform/resource/before/SuperBuilderBasicToBuilder.java32
-rw-r--r--test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java18
3 files changed, 70 insertions, 0 deletions
diff --git a/test/transform/resource/before/SuperBuilderAbstractToBuilder.java b/test/transform/resource/before/SuperBuilderAbstractToBuilder.java
new file mode 100644
index 00000000..3359829c
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderAbstractToBuilder.java
@@ -0,0 +1,20 @@
+public class SuperBuilderAbstractToBuilder {
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class Parent {
+ int parentField;
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public abstract static class Child extends Parent {
+ double childField;
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class GrandChild extends Child {
+ String grandChildField;
+ }
+
+ public static void test() {
+ GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build();
+ }
+}
diff --git a/test/transform/resource/before/SuperBuilderBasicToBuilder.java b/test/transform/resource/before/SuperBuilderBasicToBuilder.java
new file mode 100644
index 00000000..93161443
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderBasicToBuilder.java
@@ -0,0 +1,32 @@
+import java.util.List;
+
+public class SuperBuilderBasicToBuilder {
+ @lombok.experimental.SuperBuilder(toBuilder=true)
+ public static class Parent {
+ private int field1;
+ @lombok.Builder.ObtainVia(field="field1")
+ int obtainViaField;
+ @lombok.Builder.ObtainVia(method="method")
+ int obtainViaMethod;
+ @lombok.Builder.ObtainVia(method = "staticMethod", isStatic = true)
+ String obtainViaStaticMethod;
+ @lombok.Singular List<String> items;
+
+ private int method() {
+ return 2;
+ }
+
+ private static String staticMethod(Parent instance) {
+ return "staticMethod";
+ }
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder=true)
+ public static class Child extends Parent {
+ private double field3;
+ }
+
+ public static void test() {
+ Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build();
+ }
+}
diff --git a/test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java
new file mode 100644
index 00000000..dae68034
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java
@@ -0,0 +1,18 @@
+import java.util.List;
+
+public class SuperBuilderWithGenericsAndToBuilder {
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class Parent<A> {
+ A field1;
+ @lombok.Singular List<String> items;
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class Child<A> extends Parent<A> {
+ double field3;
+ }
+
+ public static void test() {
+ Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build().toBuilder().build();
+ }
+}