private Object [ ] resolveArguments ( Manager manager , Object event ) { final Class < ? > [ ] argumentTypes = getMethod ( ) . getParameterTypes ( ) ; int numberOfArguments = argumentTypes . length ; // we know that the first Argument is always the Event, and it will be there else this wouldn't be a Observer method Object [ ] arguments = new Object [ numberOfArguments ] ; arguments [ 0 ] = event ; for ( int i = 1 ; i < numberOfArguments ; i ++ ) { final Class < ? > argumentType = argumentTypes [ i ] ; arguments [ i ] = manager . resolve ( argumentType ) ; if ( RuntimeLogger . DEBUG && arguments [ i ] == null ) { log . warning ( String . format ( "Argument %d (of type %s) for %s#%s is null. Observer method won't be invoked." , i + 1 , argumentType . getSimpleName ( ) , getMethod ( ) . getDeclaringClass ( ) . getName ( ) , getMethod ( ) . getName ( ) ) ) ; } } return arguments ; }
Resolve all Observer method arguments . Unresolved argument types wil be null .