1
1
import java .util .List ;
2
2
public class SuperBuilderCustomized {
3
- public static class Parent {
4
- public static abstract class ParentBuilder <C extends Parent , B extends ParentBuilder <C , B >> {
3
+ public static class Parent < T > {
4
+ public static abstract class ParentBuilder <T , C extends Parent < T > , B extends ParentBuilder <T , C , B >> {
5
5
@ java .lang .SuppressWarnings ("all" )
6
6
private int field1 ;
7
7
public B resetToDefault () {
@@ -23,31 +23,31 @@ public java.lang.String toString() {
23
23
}
24
24
}
25
25
int field1 ;
26
- protected Parent (ParentBuilder <?, ?> b ) {
26
+ protected Parent (ParentBuilder <?, ?, ? > b ) {
27
27
if (b .field1 == 0 ) throw new IllegalArgumentException ("field1 must be != 0" );
28
28
this .field1 = b .field1 ;
29
29
}
30
- public static SuperBuilderCustomized .Parent .ParentBuilder <?, ?> builder (int field1 ) {
30
+ public static SuperBuilderCustomized .Parent .ParentBuilder <?, ?, ? > builder (int field1 ) {
31
31
return new SuperBuilderCustomized .Parent .ParentBuilderImpl ().field1 (field1 );
32
32
}
33
33
@ java .lang .SuppressWarnings ("all" )
34
- private static final class ParentBuilderImpl extends SuperBuilderCustomized .Parent .ParentBuilder <SuperBuilderCustomized .Parent , SuperBuilderCustomized .Parent .ParentBuilderImpl > {
34
+ private static final class ParentBuilderImpl < T > extends SuperBuilderCustomized .Parent .ParentBuilder <T , SuperBuilderCustomized .Parent < T > , SuperBuilderCustomized .Parent .ParentBuilderImpl < T > > {
35
35
@ java .lang .SuppressWarnings ("all" )
36
36
private ParentBuilderImpl () {
37
37
}
38
38
@ java .lang .Override
39
39
@ java .lang .SuppressWarnings ("all" )
40
- protected SuperBuilderCustomized .Parent .ParentBuilderImpl self () {
40
+ protected SuperBuilderCustomized .Parent .ParentBuilderImpl < T > self () {
41
41
return this ;
42
42
}
43
43
@ java .lang .Override
44
44
@ java .lang .SuppressWarnings ("all" )
45
- public SuperBuilderCustomized .Parent build () {
46
- return new SuperBuilderCustomized .Parent (this );
45
+ public SuperBuilderCustomized .Parent < T > build () {
46
+ return new SuperBuilderCustomized .Parent < T > (this );
47
47
}
48
48
}
49
49
}
50
- public static class Child extends Parent {
50
+ public static class Child extends Parent < String > {
51
51
private static final class ChildBuilderImpl extends ChildBuilder <Child , ChildBuilderImpl > {
52
52
@ Override
53
53
public Child build () {
@@ -68,7 +68,7 @@ protected SuperBuilderCustomized.Child.ChildBuilderImpl self() {
68
68
return new ChildBuilderImpl ().field2 (10.0 );
69
69
}
70
70
@ java .lang .SuppressWarnings ("all" )
71
- public static abstract class ChildBuilder <C extends SuperBuilderCustomized .Child , B extends SuperBuilderCustomized .Child .ChildBuilder <C , B >> extends Parent .ParentBuilder <C , B > {
71
+ public static abstract class ChildBuilder <C extends SuperBuilderCustomized .Child , B extends SuperBuilderCustomized .Child .ChildBuilder <C , B >> extends Parent .ParentBuilder <String , C , B > {
72
72
@ java .lang .SuppressWarnings ("all" )
73
73
private double field2 ;
74
74
/**
0 commit comments