public void dispatchMethod ( String name , Object [ ] arguments ) { // first check the cache Method method = _mcache . get ( name ) ; if ( method == null ) { // if we haven't already determined this method doesn't exist, try // to resolve it if ( ! _mcache . containsKey ( name ) ) { _mcache . put ( name , method = resolveMethod ( name , arguments ) ) ; } } if ( method != null ) { try { method . invoke ( _target , arguments ) ; } catch ( Exception e ) { log . warning ( "Failed to dispatch event callback " + name + "(" + StringUtil . toString ( arguments ) + ")." , e ) ; } } }
Dynamically looks up the method in question on our target and dispatches an event if it does .