-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathUnmappedSuperBuilderMultiLevelTargetPropertiesData.java
More file actions
145 lines (109 loc) · 4.02 KB
/
UnmappedSuperBuilderMultiLevelTargetPropertiesData.java
File metadata and controls
145 lines (109 loc) · 4.02 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at https://www.apache.org/licenses/LICENSE-2.0
*/
package org.example.data;
public class UnmappedSuperBuilderMultiLevelTargetPropertiesData {
public static class BaseEntity {
Long id;
protected BaseEntity(BaseEntityBuilder<?, ?> b) {
this.id = b.id;
}
public static BaseEntityBuilder<?, ?> builder() {
return new BaseEntityBuilderImpl();
}
public static abstract class BaseEntityBuilder<C extends BaseEntity, B extends BaseEntityBuilder<C, B>> {
private Long id;
public B id(Long id) {
this.id = id;
return self();
}
protected abstract B self();
public abstract C build();
public String toString() {
return "BaseEntity.BaseEntityBuilder(id=" + this.id + ")";
}
}
private static final class BaseEntityBuilderImpl extends BaseEntityBuilder<BaseEntity, BaseEntityBuilderImpl> {
private BaseEntityBuilderImpl() {
}
protected BaseEntityBuilderImpl self() {
return this;
}
public BaseEntity build() {
return new BaseEntity( this );
}
}
}
public static class NamedEntity extends BaseEntity {
String name;
protected NamedEntity(NamedEntityBuilder<?, ?> b) {
super( b );
this.name = b.name;
}
public static NamedEntityBuilder<?, ?> builder() {
return new NamedEntityBuilderImpl();
}
public static abstract class NamedEntityBuilder<C extends NamedEntity, B extends NamedEntityBuilder<C, B>>
extends BaseEntityBuilder<C, B> {
private String name;
public B name(String name) {
this.name = name;
return self();
}
protected abstract B self();
public abstract C build();
public String toString() {
return "NamedEntity.NamedEntityBuilder(super=" + super.toString() + ", name=" + this.name + ")";
}
}
private static final class NamedEntityBuilderImpl extends NamedEntityBuilder<NamedEntity, NamedEntityBuilderImpl> {
private NamedEntityBuilderImpl() {
}
protected NamedEntityBuilderImpl self() {
return this;
}
public NamedEntity build() {
return new NamedEntity( this );
}
}
}
public static class PersonEntity extends NamedEntity {
int age;
protected PersonEntity(PersonEntityBuilder<?, ?> b) {
super( b );
this.age = b.age;
}
public static PersonEntityBuilder<?, ?> builder() {
return new PersonEntityBuilderImpl();
}
public static abstract class PersonEntityBuilder<C extends PersonEntity, B extends PersonEntityBuilder<C, B>>
extends NamedEntityBuilder<C, B> {
private int age;
public B age(int age) {
this.age = age;
return self();
}
public C someIrrelevantMethod(int someParameter) {
return null;
}
protected abstract B self();
public abstract C build();
public String toString() {
return "PersonEntity.PersonEntityBuilder(super=" + super.toString() + ", age=" + this.age + ")";
}
}
private static final class PersonEntityBuilderImpl
extends PersonEntityBuilder<PersonEntity, PersonEntityBuilderImpl> {
private PersonEntityBuilderImpl() {
}
protected PersonEntityBuilderImpl self() {
return this;
}
public PersonEntity build() {
return new PersonEntity( this );
}
}
}
}