public < EventT > Object register ( Class < EventT > eventClass , Consumer < EventT > listener ) { LOG . debug ( "[{}] Registering {} for {}" , logPrefix , listener , eventClass ) ; listeners . put ( eventClass , listener ) ; // The reason for the key mechanism is that this will often be used with method references, // and you get a different object every time you reference a method, so register(Foo::bar) // followed by unregister(Foo::bar) wouldn't work as expected. return listener ; }
Registers a listener for an event type .