Class ClassLoaderHelper
java.lang.Object
software.amazon.awssdk.core.internal.util.ClassLoaderHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClassLoader
classLoader
(Class<?>... classes) Attempt to get class loader that loads the classes and fallback to the thread context classloader if null.static Class
<?> 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
<?> 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 Details
-
loadClass
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
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
-