|
32 | 32 | import java.util.Set;
|
33 | 33 | import java.util.function.Function;
|
34 | 34 | import java.util.stream.Collectors;
|
35 |
| -import lombok.Builder; |
| 35 | +import lombok.AccessLevel; |
| 36 | +import lombok.AllArgsConstructor; |
36 | 37 | import lombok.NonNull;
|
37 | 38 |
|
38 |
| -@Builder |
| 39 | +@AllArgsConstructor(access = AccessLevel.PRIVATE) |
39 | 40 | public class StateGenerator implements Serializable {
|
40 | 41 | @NonNull private final SerializableFunction<Address, Node> serverSupplier;
|
41 | 42 | @NonNull private final SerializableFunction<Address, Client> clientSupplier;
|
@@ -126,7 +127,15 @@ public Map<Address, ClientWorker> clientWorkers(
|
126 | 127 | recordCommandsAndResults)));
|
127 | 128 | }
|
128 | 129 |
|
| 130 | + public static StateGeneratorBuilder builder() { |
| 131 | + return new StateGeneratorBuilder(); |
| 132 | + } |
| 133 | + |
129 | 134 | public static class StateGeneratorBuilder {
|
| 135 | + private SerializableFunction<Address, Node> serverSupplier; |
| 136 | + private SerializableFunction<Address, Client> clientSupplier; |
| 137 | + private SerializableFunction<Address, Workload> workloadSupplier; |
| 138 | + |
130 | 139 | public StateGeneratorBuilder serverSupplier(
|
131 | 140 | SerializableFunction<Address, Node> serverSupplier) {
|
132 | 141 | this.serverSupplier = serverSupplier;
|
@@ -160,5 +169,11 @@ public StateGeneratorBuilder workloadSupplier(Workload workload) {
|
160 | 169 | this.workloadSupplier = __ -> workload;
|
161 | 170 | return this;
|
162 | 171 | }
|
| 172 | + |
| 173 | + public StateGenerator build() { |
| 174 | + return new StateGenerator(this.serverSupplier, this.clientSupplier, this.workloadSupplier); |
| 175 | + } |
| 176 | + |
| 177 | + private StateGeneratorBuilder() {} |
163 | 178 | }
|
164 | 179 | }
|
0 commit comments