/** * @param clazz the class of the beans * @param <T> the Bean type * @param beans the collection to add beans of the given class from the entire managed hierarchy */ protected <T> void getContainedBeans(Class<T> clazz, Collection<T> beans) { beans.addAll(getBeans(clazz)); for (Container c : getBeans(Container.class)) { Bean bean = getBean(c); if (bean!=null && bean.isManageable()) { if (c instanceof ContainerLifeCycle) ((ContainerLifeCycle)c).getContainedBeans(clazz, beans); else beans.addAll(c.getContainedBeans(clazz)); } } } }
/** * @param clazz the class of the beans * @param <T> the Bean type * @param beans the collection to add beans of the given class from the entire managed hierarchy */ protected <T> void getContainedBeans(Class<T> clazz, Collection<T> beans) { beans.addAll(getBeans(clazz)); for (Container c : getBeans(Container.class)) { Bean bean = getBean(c); if (bean!=null && bean.isManageable()) { if (c instanceof ContainerLifeCycle) ((ContainerLifeCycle)c).getContainedBeans(clazz, beans); else beans.addAll(c.getContainedBeans(clazz)); } } } }