We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 380f6ae commit 5141864Copy full SHA for 5141864
src/main/java/com/github/adamzink/springbootmysqldemo/converter/common/ModelConverter.java
@@ -1,9 +1,21 @@
1
package com.github.adamzink.springbootmysqldemo.converter.common;
2
3
+import java.util.ArrayList;
4
+import java.util.Collection;
5
+
6
public interface ModelConverter<Q, M, S> {
7
8
M requestToModel(Q request);
9
10
S modelToResponse (M model);
11
12
+ default Collection<S> modelToResponse(final Iterable<M> models) {
13
+ assert models != null;
14
15
+ final Collection<S> responses = new ArrayList<S>();
16
+ models.forEach(model -> responses.add(modelToResponse(model)));
17
18
+ return responses;
19
+ }
20
21
}
0 commit comments