public static final <R>R dispatch(Class clazz,Object instance,String method,Object[] args,Class[] types) throws NoSuchMethodException {
  try {
    java.lang.reflect.Method m=clazz.getDeclaredMethod(method,types);
    m.setAccessible(true);
    return (R)m.invoke(instance,args);
  }
 catch (  NoSuchMethodException x) {
    if (clazz.getSuperclass() != null)     return (R)dispatch(clazz.getSuperclass(),instance,method,args,types);
 else     throw x;
  }
catch (  Exception x) {
    throw new RuntimeException(x);
  }
}

public static final < R > R dispatch ( Class clazz , Object instance , String method , Object [ ] args , Class [ ] types ) throws NoSuchMethodException { try { java . lang . reflect . Method m = clazz . getDeclaredMethod ( method , types ) ; m . setAccessible ( true ) ; return ( R ) m . invoke ( instance , args ) ; } catch ( NoSuchMethodException x ) { if ( clazz . getSuperclass ( ) != null ) return ( R ) dispatch ( clazz . getSuperclass ( ) , instance , method , args , types ) ; else throw x ; } catch ( Exception x ) { throw new RuntimeException ( x ) ; } }
dispatch ` args ` of ` types ` to ` method ` on ` clazz ` for ` instance ` . if ` method ` is static , ` instance ` should be null .
