@ SuppressWarnings ( "unchecked" ) protected List < T > getEnabledListeners ( Class < ? extends T > ... classes ) { List < T > listeners = new ArrayList < T > ( ) ; for ( Class < ? extends T > clazz : classes ) { Set < Bean < ? > > beans = getBeanManager ( ) . getBeans ( clazz ) ; if ( ! beans . isEmpty ( ) ) { Bean < T > bean = ( Bean < T > ) getBeanManager ( ) . resolve ( beans ) ; CreationalContext < T > context = getBeanManager ( ) . createCreationalContext ( bean ) ; listeners . add ( ( T ) getBeanManager ( ) . getReference ( bean , clazz , context ) ) ; } } return listeners ; }
Create contextual instances for the specified listener classes excluding any listeners that do not correspond to an enabled bean .