EmbeddableComponentManager implements NamespacedComponentManager, Disposable { @Override @SuppressWarnings("unchecked") public <T> List<ComponentDescriptor<T>> getComponentDescriptorList(Type role) { Map<String, ComponentDescriptor<T>> descriptors = new HashMap<>(); Map<String, ComponentEntry<?>> enries = this.componentEntries.get(role); if (enries != null) { for (Map.Entry<String, ComponentEntry<?>> entry : enries.entrySet()) { descriptors.put(entry.getKey(), (ComponentDescriptor<T>) entry.getValue().descriptor); } } if (getParent() != null) { List<ComponentDescriptor<T>> parentDescriptors = getParent().getComponentDescriptorList(role); for (ComponentDescriptor<T> parentDescriptor : parentDescriptors) { if (!descriptors.containsKey(parentDescriptor.getRoleHint())) { descriptors.put(parentDescriptor.getRoleHint(), parentDescriptor); } } } return new ArrayList<>(descriptors.values()); } EmbeddableComponentManager();  EmbeddableComponentManager(String namespace); @Override String getNamespace(); void initialize(ClassLoader classLoader); @Override boolean hasComponent(Type role); @Override boolean hasComponent(Type roleType, String roleHint); @Override T getInstance(Type roleType); @Override T getInstance(Type roleType, String roleHint); @Override List<T> getInstanceList(Type role); @Override @SuppressWarnings("unchecked") Map<String, T> getInstanceMap(Type roleType); @Override @SuppressWarnings("unchecked") ComponentDescriptor<T> getComponentDescriptor(Type role, String hint); @Override @SuppressWarnings("unchecked") List<ComponentDescriptor<T>> getComponentDescriptorList(Type role); @Override ComponentEventManager getComponentEventManager(); @Override void setComponentEventManager(ComponentEventManager eventManager); @Override ComponentManager getParent(); @Override void setParent(ComponentManager parentComponentManager); @Override void registerComponent(ComponentDescriptor<T> componentDescriptor); @Override void registerComponent(ComponentDescriptor<T> componentDescriptor, T componentInstance); @Override void unregisterComponent(Type role, String hint); @Override void unregisterComponent(ComponentDescriptor<?> componentDescriptor); @Override void release(Object component); @Override void dispose(); @Override @Deprecated List<ComponentDescriptor<T>> getComponentDescriptorList(Class<T> role);  }
@Test void getComponentDescriptorList() throws Exception { EmbeddableComponentManager ecm = new EmbeddableComponentManager(); DefaultComponentDescriptor<Role> d1 = new DefaultComponentDescriptor<>(); d1.setRoleType(Role.class); d1.setRoleHint("hint1"); ecm.registerComponent(d1); DefaultComponentDescriptor<Role> d2 = new DefaultComponentDescriptor<>(); d2.setRoleType(Role.class); d2.setRoleHint("hint2"); ecm.registerComponent(d2); List<ComponentDescriptor<Role>> cds = ecm.getComponentDescriptorList(Role.class); assertEquals(2, cds.size()); assertTrue(cds.contains(d1)); assertTrue(cds.contains(d2)); }