工程师 (已认证)
原创分享签约作者
* If classesFirst is true, loads the class via the optionally * specified classes in the order of their specification, and if not found, * via the context class loader of the current thread, and if not found, * from the caller class loader as the last resort. * * @param fqcn * fully qualified class name of the target class to be loaded * @param classesFirst * true if the class loaders of the optionally specified classes * take precedence over the context class loader of the current * thread; false if the opposite is true. * @param classes * class loader providers * @return the class loaded; never null * * @throws ClassNotFoundException if failed to load the class */ public static Class> loadClass(String fqcn, boolean classesFirst, Class>... classes) throws ClassNotFoundException { Class> target = null; if (classesFirst) { target = loadClassViaClasses(fqcn, classes); if (target == null) { target = loadClassViaContext(fqcn); } } else { target = loadClassViaContext(fqcn); if (target == null) { target = loadClassViaClasses(fqcn, classes); } } /**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。
分享文章到朋友圈
关注时代Java