/** * Internal helper method to resolve the right bean and resolve the contextual reference. * * @param type the type of the bean in question * @param beanManager current bean-manager * @param beans beans in question * @param <T> target type * @return the contextual reference */ private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Set<Bean<?>> beans) { Bean<?> bean = beanManager.resolve(beans); logWarningIfDependent(bean); CreationalContext<?> creationalContext = beanManager.createCreationalContext(bean); @SuppressWarnings({ "unchecked", "UnnecessaryLocalVariable" }) T result = (T) beanManager.getReference(bean, type, creationalContext); return result; }
/** * Internal helper method to resolve the right bean and resolve the contextual reference. * * @param type the type of the bean in question * @param beanManager current bean-manager * @param beans beans in question * @param <T> target type * @return the contextual reference */ private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Set<Bean<?>> beans) { Bean<?> bean = beanManager.resolve(beans); logWarningIfDependent(bean); CreationalContext<?> creationalContext = beanManager.createCreationalContext(bean); @SuppressWarnings({ "unchecked", "UnnecessaryLocalVariable" }) T result = (T) beanManager.getReference(bean, type, creationalContext); return result; }
/** * Internal helper method to resolve the right bean and resolve the contextual reference. * * @param type the type of the bean in question * @param beanManager current bean-manager * @param beans beans in question * @param <T> target type * @return the contextual reference */ private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Set<Bean<?>> beans) { Bean<?> bean = beanManager.resolve(beans); logWarningIfDependent(bean); CreationalContext<?> creationalContext = beanManager.createCreationalContext(bean); @SuppressWarnings({ "unchecked", "UnnecessaryLocalVariable" }) T result = (T) beanManager.getReference(bean, type, creationalContext); return result; }