public MessageListener getMessageListener ( Class target ) { MessageListener listenerMetadata = new MessageListener ( target ) ; // get all handlers (this will include all (inherited) methods directly annotated using @Handler) Method [ ] allHandlers = ReflectionUtils . getMethods ( AllMessageHandlers , target ) ; final int length = allHandlers . length ; Method handler ; for ( int i = 0 ; i < length ; i ++ ) { handler = allHandlers [ i ] ; // retain only those that are at the bottom of their respective class hierarchy (deepest overriding method) if ( ! ReflectionUtils . containsOverridingMethod ( allHandlers , handler ) ) { // for each handler there will be no overriding method that specifies @Handler annotation // but an overriding method does inherit the listener configuration of the overridden method Handler handlerConfig = ReflectionUtils . getAnnotation ( handler , Handler . class ) ; Enveloped enveloped = ReflectionUtils . getAnnotation ( handler , Enveloped . class ) ; if ( ! handlerConfig . enabled ( ) || ! isValidMessageHandler ( handler ) ) { continue ; // disabled or invalid listeners are ignored } Method overriddenHandler = ReflectionUtils . getOverridingMethod ( handler , target ) ; // if a handler is overridden it inherits the configuration of its parent method Map < String , Object > handlerProperties = MessageHandler . Properties . Create ( overriddenHandler == null ? handler : overriddenHandler , handlerConfig , enveloped , getFilter ( handler , handlerConfig ) , listenerMetadata ) ; MessageHandler handlerMetadata = new MessageHandler ( handlerProperties ) ; listenerMetadata . addHandler ( handlerMetadata ) ; } } return listenerMetadata ; }
listeners defined in super classes )