List<ComponentAdapter> (@NotNull Class<?> componentType) { if (componentType == String.class) { return Collections.emptyList(); } List<ComponentAdapter> result = new ArrayList<>(); ComponentAdapter cacheHit = componentKeyToAdapter.get(componentType.getName()); if (cacheHit != null) { result.add(cacheHit); } for (ComponentAdapter adapter : componentKeyToAdapter.values()) { // exclude services if (adapter.getComponentKey() instanceof String) { continue; } Class<?> descendant = adapter.getComponentImplementation(); if (componentType == descendant || componentType.isAssignableFrom(descendant)) { result.add(adapter); } } return result; }