@Override public void beforeFindComponents() { supportingTypesStrategies.forEach(sts -> sts.setTypeRepository(getTypeRepository())); }
protected Set<Class<?>> findTypesAnnotatedWith(Class<? extends Annotation> annotation) { return TypeUtils.findTypesAnnotatedWith(annotation, getTypeRepository().getAllTypes()); }
private void addEfferentDependencies(Component component, String type, Set<String> typesVisited) { typesVisited.add(type); for (Class<?> referencedType : getTypeRepository().findReferencedTypes(type)) { try { if (!isNestedClass(referencedType)) { String referencedTypeName = referencedType.getCanonicalName(); if (!StringUtils.isNullOrEmpty(referencedTypeName)) { Component destinationComponent = componentFinder.getContainer().getComponentOfType(referencedTypeName); if (destinationComponent != null) { if (component != destinationComponent) { component.uses(destinationComponent, ""); } } else if (!typesVisited.contains(referencedTypeName)) { addEfferentDependencies(component, referencedTypeName, typesVisited); } } } } catch (Throwable t) { log.warn(t); } } }
private void findSupportingTypes(Set<Component> components) { for (Component component : components) { for (CodeElement codeElement : component.getCode()) { TypeVisibility visibility = TypeUtils.getVisibility(getTypeRepository(), codeElement.getType()); if (visibility != null) { codeElement.setVisibility(visibility.getName()); } TypeCategory category = TypeUtils.getCategory(getTypeRepository(), codeElement.getType()); if (category != null) { codeElement.setCategory(category.getName()); } } for (SupportingTypesStrategy strategy : supportingTypesStrategies) { for (Class<?> type : strategy.findSupportingTypes(component)) { if (!isNestedClass(type) && componentFinder.getContainer().getComponentOfType(type.getCanonicalName()) == null) { CodeElement codeElement = component.addSupportingType(type.getCanonicalName()); TypeVisibility visibility = TypeUtils.getVisibility(getTypeRepository(), codeElement.getType()); if (visibility != null) { codeElement.setVisibility(visibility.getName()); } TypeCategory category = TypeUtils.getCategory(getTypeRepository(), codeElement.getType()); if (category != null) { codeElement.setCategory(category.getName()); } } } } } }