Search in sources :

Example 16 with RebuildException

use of com.rebuild.core.RebuildException in project rebuild by getrebuild.

the class CommonsUtils method invokeMethod.

/**
 * @param desc
 * @param args
 * @return
 */
public static Object invokeMethod(String desc, Object... args) {
    String[] classAndMethod = desc.split("#");
    try {
        Class<?> clazz = Class.forName(classAndMethod[0]);
        Class<?>[] paramTypes = new Class<?>[args.length];
        for (int i = 0; i < args.length; i++) {
            paramTypes[i] = args[i].getClass();
        }
        Method method = clazz.getMethod(classAndMethod[1], paramTypes);
        return method.invoke(null, args);
    } catch (ReflectiveOperationException ex) {
        log.error("Invalid method invoke : {}", desc);
        throw new RebuildException(ex);
    }
}
Also used : RebuildException(com.rebuild.core.RebuildException) Method(java.lang.reflect.Method)

Aggregations

RebuildException (com.rebuild.core.RebuildException)16 ID (cn.devezhao.persist4j.engine.ID)4 Entity (cn.devezhao.persist4j.Entity)2 JSONObject (com.alibaba.fastjson.JSONObject)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Cipher (javax.crypto.Cipher)2 SecretKeySpec (javax.crypto.spec.SecretKeySpec)2 Cell (cn.devezhao.commons.excel.Cell)1 Field (cn.devezhao.persist4j.Field)1 Record (cn.devezhao.persist4j.Record)1 PersistManagerImpl (cn.devezhao.persist4j.engine.PersistManagerImpl)1 MetadataException (cn.devezhao.persist4j.metadata.MetadataException)1 MissingMetaExcetion (cn.devezhao.persist4j.metadata.MissingMetaExcetion)1 AnalysisContext (com.alibaba.excel.context.AnalysisContext)1 AnalysisEventListener (com.alibaba.excel.event.AnalysisEventListener)1 JSON (com.alibaba.fastjson.JSON)1 JSONArray (com.alibaba.fastjson.JSONArray)1 EncodeHintType (com.google.zxing.EncodeHintType)1