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 .