public < T extends EventListener > void subscribe ( EventPublisher source , T listener ) { if ( source == null || listener == null ) { throw new IllegalArgumentException ( "Parameters cannot be null" ) ; } log . debug ( "[subscribe] Adding {} --> {}" , source . getClass ( ) . getName ( ) , listener . getClass ( ) . getName ( ) ) ; GenericEventDispatcher < T > dispatcher = ( GenericEventDispatcher < T > ) dispatchers . get ( source ) ; if ( dispatcher == null ) { log . warn ( "[subscribe] Registering with a disconnected source" ) ; dispatcher = createDispatcher ( source ) ; } dispatcher . addListener ( listener ) ; }
Binds a listener to a publisher