Package software.amazon.awssdk.utils
Class ClassLoaderHelper
- java.lang.Object
-
- software.amazon.awssdk.utils.ClassLoaderHelper
-
public final class ClassLoaderHelper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Method Detail
-
loadClass
public static Class<?> loadClass(String fqcn, Class<?>... classes) throws ClassNotFoundException
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.- Parameters:
fqcn
- fully qualified class name of the target class to be loadedclasses
- class loader providers- Returns:
- the class loaded; never null
- Throws:
ClassNotFoundException
- if failed to load the class
-
loadClass
public static Class<?> loadClass(String fqcn, boolean classesFirst, Class<?>... classes) throws ClassNotFoundException
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.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.
- Parameters:
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 providers- Returns:
- the class loaded; never null
- Throws:
ClassNotFoundException
- if failed to load the class
-
classLoader
public static ClassLoader classLoader(Class<?>... classes)
Attempt to get class loader that loads the classes and fallback to the thread context classloader if null.- Parameters:
classes
- the classes- Returns:
- a
ClassLoader
or null if none found
-
-