aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/before
diff options
context:
space:
mode:
Diffstat (limited to 'test/transform/resource/before')
-rw-r--r--test/transform/resource/before/SuperBuilderCustomized.java4
-rw-r--r--test/transform/resource/before/SuperBuilderCustomizedWithSetterPrefix.java18
-rw-r--r--test/transform/resource/before/SuperBuilderWithSetterPrefix.java32
3 files changed, 54 insertions, 0 deletions
diff --git a/test/transform/resource/before/SuperBuilderCustomized.java b/test/transform/resource/before/SuperBuilderCustomized.java
index 58f2797c..77830587 100644
--- a/test/transform/resource/before/SuperBuilderCustomized.java
+++ b/test/transform/resource/before/SuperBuilderCustomized.java
@@ -8,6 +8,10 @@ public class SuperBuilderCustomized {
field1 = 0;
return self();
}
+ public B field1(int field1) {
+ this.field1 = field1 + 1;
+ return self();
+ }
}
int field1;
}
diff --git a/test/transform/resource/before/SuperBuilderCustomizedWithSetterPrefix.java b/test/transform/resource/before/SuperBuilderCustomizedWithSetterPrefix.java
new file mode 100644
index 00000000..be2cfc4a
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderCustomizedWithSetterPrefix.java
@@ -0,0 +1,18 @@
+import java.util.List;
+
+public class SuperBuilderCustomizedWithSetterPrefix {
+ @lombok.experimental.SuperBuilder(setterPrefix = "set")
+ public static class Parent {
+ public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> {
+ public B setField1(int field1) {
+ this.field1 = field1 + 1;
+ return self();
+ }
+ }
+ int field1;
+ }
+
+ public static void test() {
+ Parent x = Parent.builder().setField1(5).build();
+ }
+}
diff --git a/test/transform/resource/before/SuperBuilderWithSetterPrefix.java b/test/transform/resource/before/SuperBuilderWithSetterPrefix.java
new file mode 100644
index 00000000..5eaef360
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderWithSetterPrefix.java
@@ -0,0 +1,32 @@
+import java.util.List;
+
+public class SuperBuilderWithSetterPrefix {
+ @lombok.experimental.SuperBuilder(toBuilder=true, setterPrefix = "with")
+ 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, setterPrefix = "set")
+ public static class Child extends Parent {
+ private double field3;
+ }
+
+ public static void test() {
+ Child x = Child.builder().setField3(0.0).withField1(5).withItem("").build().toBuilder().build();
+ }
+}