|
18 | 18 | import static java.util.stream.Collectors.*;
|
19 | 19 | import static org.springframework.util.ClassUtils.*;
|
20 | 20 |
|
| 21 | +import java.util.Collection; |
21 | 22 | import java.util.List;
|
22 | 23 | import java.util.Optional;
|
23 | 24 | import java.util.regex.Matcher;
|
@@ -321,29 +322,30 @@ private String toInlineCode(ArchitecturallyEvidentType type) {
|
321 | 322 | private String renderReferenceMethod(ReferenceMethod it, int level) {
|
322 | 323 |
|
323 | 324 | var method = it.getMethod();
|
324 |
| - Assert.isTrue(method.getRawParameterTypes().size() > 0, |
325 |
| - () -> "Method %s must have at least one parameter!".formatted(method)); |
| 325 | + var exposedReferenceTypes = it.getReferenceTypes().stream() |
| 326 | + .filter(type -> modules.getModuleByType(type) |
| 327 | + .map(module -> module.isExposed(type)) |
| 328 | + .orElse(true)) |
| 329 | + .toList(); |
326 | 330 |
|
327 |
| - var parameterType = method.getRawParameterTypes().get(0); |
328 |
| - |
329 |
| - var typeExposed = modules.getModuleByType(parameterType) |
330 |
| - .map(module -> module.isExposed(parameterType)) |
331 |
| - .orElse(true); |
332 |
| - |
333 |
| - if (!typeExposed) { |
| 331 | + if (exposedReferenceTypes.isEmpty()) { |
334 | 332 | return "";
|
335 | 333 | }
|
336 | 334 |
|
337 | 335 | var isAsync = it.isAsync() ? "(async) " : "";
|
338 | 336 | var indent = "*".repeat(level + 1);
|
339 | 337 |
|
340 | 338 | return docSource.flatMap(source -> source.getDocumentation(method))
|
341 |
| - .map(doc -> "%s %s %s-- %s".formatted(indent, toInlineCode(parameterType), isAsync, doc)) |
342 |
| - .orElseGet(() -> "%s %s %s".formatted(indent, toInlineCode(parameterType), isAsync)); |
| 339 | + .map(doc -> "%s %s %s-- %s".formatted(indent, toInlineCode(exposedReferenceTypes), isAsync, doc)) |
| 340 | + .orElseGet(() -> "%s %s %s".formatted(indent, toInlineCode(exposedReferenceTypes), isAsync)); |
343 | 341 | }
|
344 | 342 |
|
345 |
| - private String toInlineCode(Stream<JavaClass> types) { |
346 |
| - return types.map(this::toInlineCode).collect(joining(", ")); |
| 343 | + private String toInlineCode(Collection<Class<?>> types) { |
| 344 | + |
| 345 | + return types.stream() |
| 346 | + .map(Class::getName) |
| 347 | + .map(this::toInlineCode) |
| 348 | + .collect(joining(", ")); |
347 | 349 | }
|
348 | 350 |
|
349 | 351 | private static String toLink(String source, String href) {
|
|
0 commit comments