private void extractFeignClientRelationships()

in doc-architect/doc-architect-core/src/main/java/com/docarchitect/core/scanner/impl/java/JavaHttpClientScanner.java [422:470]


    private void extractFeignClientRelationships(
            CompilationUnit cu,
            String sourceComponentId,
            List<Relationship> relationships,
            Set<String> processedRelationships) {

        // Find all classes/interfaces
        List<ClassOrInterfaceDeclaration> classes = findClasses(cu);

        for (ClassOrInterfaceDeclaration clazz : classes) {
            // Check if class/interface has @FeignClient annotation
            if (!hasAnnotation(clazz, FEIGN_CLIENT_ANNOTATION)) {
                continue;
            }

            // Extract service name from @FeignClient annotation
            String serviceName = getAnnotationAttribute(clazz, FEIGN_CLIENT_ANNOTATION, NAME_ATTRIBUTE);
            if (serviceName == null || serviceName.isEmpty()) {
                serviceName = getAnnotationAttribute(clazz, FEIGN_CLIENT_ANNOTATION, VALUE_ATTRIBUTE);
            }

            // Also check for URL attribute (can contain service URL)
            String serviceUrl = getAnnotationAttribute(clazz, FEIGN_CLIENT_ANNOTATION, URL_ATTRIBUTE);

            String targetService = null;

            // Prefer service name from annotation
            if (serviceName != null && !serviceName.isEmpty()) {
                targetService = serviceName;
            } else if (serviceUrl != null && !serviceUrl.isEmpty()) {
                // Extract service name from URL
                targetService = extractServiceNameFromUrl(serviceUrl);
            }

            if (targetService != null && !targetService.isEmpty()) {
                String targetComponentId = IdGenerator.generate(targetService);
                addRelationship(
                    sourceComponentId,
                    targetComponentId,
                    "Feign client call to " + targetService,
                    "HTTP/Feign",
                    relationships,
                    processedRelationships
                );

                log.debug("Found Feign client: {} -> {}", sourceComponentId, targetService);
            }
        }
    }