|
21 | 21 | import java.util.LinkedHashSet;
|
22 | 22 | import java.util.Map;
|
23 | 23 | import java.util.Set;
|
24 |
| -import java.util.function.Consumer; |
| 24 | +import java.util.function.BiConsumer; |
25 | 25 | import java.util.stream.Collectors;
|
26 | 26 |
|
27 | 27 | import org.springframework.util.Assert;
|
@@ -54,16 +54,24 @@ public Registration getOrCreateGroup(String groupName, HttpServiceGroup.ClientTy
|
54 | 54 | * Merge all registrations from the given {@link GroupsMetadata} into this one.
|
55 | 55 | */
|
56 | 56 | public void mergeWith(GroupsMetadata other) {
|
57 |
| - other.forEachRegistration(registration -> |
| 57 | + other.groupMap.values().forEach(registration -> |
58 | 58 | getOrCreateGroup(registration.name(), registration.clientType())
|
59 | 59 | .httpServiceTypeNames()
|
60 | 60 | .addAll(registration.httpServiceTypeNames()));
|
61 | 61 | }
|
62 | 62 |
|
63 |
| - public void forEachRegistration(Consumer<Registration> consumer) { |
64 |
| - this.groupMap.values().forEach(consumer); |
| 63 | + /** |
| 64 | + * Callback to apply to all registrations with access to the group name and |
| 65 | + * its HTTP service type names. |
| 66 | + */ |
| 67 | + public void forEachRegistration(BiConsumer<String, Set<String>> consumer) { |
| 68 | + this.groupMap.values().forEach(registration -> |
| 69 | + consumer.accept(registration.name(), registration.httpServiceTypeNames())); |
65 | 70 | }
|
66 | 71 |
|
| 72 | + /** |
| 73 | + * Create the {@link HttpServiceGroup}s for all registrations. |
| 74 | + */ |
67 | 75 | public Collection<HttpServiceGroup> groups() {
|
68 | 76 | return this.groupMap.values().stream().map(DefaultRegistration::toHttpServiceGroup).toList();
|
69 | 77 | }
|
|
0 commit comments