aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/before/SuperBuilderBasicToBuilder.java
blob: 93161443bc7a5e726c316dc33f5b81fdffa5695c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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();
	}
}