/** * Checks if scope is registered * * @param scope the scope * @return true, if is registered scope */ public static boolean isRegisteredScope(Class<? extends Annotation> scope) { return getContextClass(scope) != null; }
/** * Return all bean instances. * * @param bean the bean * @return the bean instances */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static List<Object> getBeanInstances(Bean<?> bean) { List<Object> result = new ArrayList<>(); Class<? extends Context> contextClass = getContextClass(bean.getScope()); Map beanRegistry = (Map) getBeanRegistry(contextClass); if (beanRegistry != null) { Map m = (Map) beanRegistry.get(bean.getBeanClass().getName()); if (m != null) { result.addAll(m.keySet()); } else { LOGGER.debug("BeanRegistry is empty for bean class '{}'", bean.getBeanClass().getName()); } } else { LOGGER.error("BeanRegistry field not found in context class '{}'", contextClass.getName()); } return result; }