private static Boolean methodExists(Class clazz,String methodName,Type[] args,Type returnType){
  try {
    Class<?>[] _args=new Class[args.length];
    for (int i=0; i < _args.length; i++) {
      _args[i]=Types.toClass(args[i]);
    }
    Class<?> rtn=Types.toClass(returnType);
    try {
      java.lang.reflect.Method m=clazz.getMethod(methodName,_args);
      return m.getReturnType() == rtn;
    }
 catch (    Exception e) {
      return false;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}

private static Boolean methodExists ( Class clazz , String methodName , Type [ ] args , Type returnType ) { try { Class < ? > [ ] _args = new Class [ args . length ] ; for ( int i = 0 ; i < _args . length ; i ++ ) { _args [ i ] = Types . toClass ( args [ i ] ) ; } Class < ? > rtn = Types . toClass ( returnType ) ; try { java . lang . reflect . Method m = clazz . getMethod ( methodName , _args ) ; return m . getReturnType ( ) == rtn ; } catch ( Exception e ) { return false ; } } catch ( Exception e ) { e . printStackTrace ( ) ; return null ; } }
checks if a method exists
