public final class ClassLoaderHelper extends Object
| Modifier and Type | Method and Description | 
|---|---|
| static ClassLoader | classLoader(Class<?>... classes)Attempt to get class loader that loads the classes and fallback to the thread context classloader if null. | 
| static Class<?> | loadClass(String fqcn,
         boolean classesFirst,
         Class<?>... classes)If classesFirst is false, loads the class via the context class
 loader of the current thread, and if not found, via the class loaders of
 the optionally specified classes in the order of their specification, and
 if not found, from the caller class loader as the
 last resort. | 
| static Class<?> | loadClass(String fqcn,
         Class<?>... classes)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. | 
public static Class<?> loadClass(String fqcn, Class<?>... classes) throws ClassNotFoundException
fqcn - fully qualified class name of the target class to be loadedclasses - class loader providersClassNotFoundException - if failed to load the classpublic static Class<?> loadClass(String fqcn, boolean classesFirst, Class<?>... classes) throws ClassNotFoundException
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.
fqcn - fully qualified class name of the target class to be loadedclassesFirst - 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.classes - class loader providersClassNotFoundException - if failed to load the classpublic static ClassLoader classLoader(Class<?>... classes)
classes - the classesClassLoader or null if none foundCopyright © 2023. All rights reserved.