@SuppressWarnings("unchecked") public static <R>R callStaticMethod(Class<?> clazz,String methodName,ClassParameter<?>... classParameters){
  try {
    Class<?>[] classes=ClassParameter.getClasses(classParameters);
    Object[] values=ClassParameter.getValues(classParameters);
    Method method=clazz.getDeclaredMethod(methodName,classes);
    method.setAccessible(true);
    return (R)method.invoke(null,values);
  }
 catch (  InvocationTargetException e) {
    if (e.getTargetException() instanceof RuntimeException) {
      throw (RuntimeException)e.getTargetException();
    }
    if (e.getTargetException() instanceof Error) {
      throw (Error)e.getTargetException();
    }
    throw new RuntimeException(e.getTargetException());
  }
catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

@ SuppressWarnings ( "unchecked" ) public static < R > R callStaticMethod ( Class < ? > clazz , String methodName , ClassParameter < ? > ... classParameters ) { try { Class < ? > [ ] classes = ClassParameter . getClasses ( classParameters ) ; Object [ ] values = ClassParameter . getValues ( classParameters ) ; Method method = clazz . getDeclaredMethod ( methodName , classes ) ; method . setAccessible ( true ) ; return ( R ) method . invoke ( null , values ) ; } catch ( InvocationTargetException e ) { if ( e . getTargetException ( ) instanceof RuntimeException ) { throw ( RuntimeException ) e . getTargetException ( ) ; } if ( e . getTargetException ( ) instanceof Error ) { throw ( Error ) e . getTargetException ( ) ; } throw new RuntimeException ( e . getTargetException ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
reflectively call a static method on a class .
