zoukankan      html  css  js  c++  java
  • 创建classic 得到函数 调用函数

    Class manager = null;

            try
            {
                //1. 创建class
                manager = Class.forName(name);
            }
            catch (ClassNotFoundException e)
            {
             }

            Method oMethod = null;

            try
            {
                //2. 得到函数
                oMethod = manager.getMethod("getInstance", null);
            }
            catch (Exception e)
            {
             }

           IInitializable initializable = null;

            try
            {
                //3. 调用函数
                initializable = (IInitializable) oMethod.invoke(null, null);
            }
            catch (Exception e)
            {
            }

            try
            {
                initializable.init(xmlStatic);
            }
            catch (Throwable e)
            {
             if (blockingError)
                {
                    FatalHandler.manage(this, CoreMessages.format("BSSE0004", name),e);
                }
             else
                {
                 logger.warn(CoreMessages.format("BSSE0004", name));
                 logger.error(e);
                }
                return;
            }

  • 相关阅读:
    HDU 1317 XYZZY(floyd+bellman_ford判环)
    UVa 10791 最小公倍数的最小和(唯一分解定理)
    UVa 12169 不爽的裁判
    UVa 11582 巨大的斐波那契数!(幂取模)
    POJ 1142 Smith Numbers(分治法+质因数分解)
    HDU 1595 find the longest of the shortest
    UVa 11090 在环中
    UVa 10917 林中漫步
    UVa 11374 机场快线
    POJ 1503 Integer Inquiry
  • 原文地址:https://www.cnblogs.com/kevinge/p/1549632.html
Copyright © 2011-2022 走看看