private void evaluateMethod ( Object listener , Class < ? extends Annotation > annotation , Method method , Map < Object , Set < Method > > methods ) { if ( method . isAnnotationPresent ( annotation ) ) { if ( method . getParameterTypes ( ) . length != 1 ) { throw new XOException ( "Life cycle method '" + method . toGenericString ( ) + "' annotated with '" + annotation . getName ( ) + "' must declare exactly one parameter but declares " + method . getParameterTypes ( ) . length + "." ) ; } Set < Method > listenerMethods = methods . get ( listener ) ; if ( listenerMethods == null ) { listenerMethods = new HashSet <> ( ) ; methods . put ( listener , listenerMethods ) ; } listenerMethods . add ( method ) ; } }
Evaluates a method if an annotation is present and if true adds to the map of life cycle methods .