public class Classes
extends java.lang.Object
| Constructor and Description |
|---|
Classes() |
| Modifier and Type | Method and Description |
|---|---|
static <T> java.lang.Class<T> |
forName(java.lang.String fqcn)
Attempts to load the specified class name from the current thread's
context class loader, then the
current ClassLoader (Classes.class.getClassLoader()), then the system/application
ClassLoader (ClassLoader.getSystemClassLoader(), in that order. |
static <T> java.lang.reflect.Constructor<T> |
getConstructor(java.lang.Class<T> clazz,
java.lang.Class... argTypes) |
static java.io.InputStream |
getResourceAsStream(java.lang.String name)
Returns the specified resource by checking the current thread's
context class loader, then the
current ClassLoader (Classes.class.getClassLoader()), then the system/application
ClassLoader (ClassLoader.getSystemClassLoader(), in that order, using
getResourceAsStream(name). |
static <T> T |
instantiate(java.lang.reflect.Constructor<T> ctor,
java.lang.Object... args) |
static boolean |
isAvailable(java.lang.String fullyQualifiedClassName) |
static <T> T |
loadFromService(java.lang.Class<T> clazz) |
static <T> T |
loadFromService(java.lang.Class<T> clazz,
java.lang.String errorMessage) |
static <T> T |
newInstance(java.lang.Class<T> clazz) |
static <T> T |
newInstance(java.lang.Class<T> clazz,
java.lang.Object... args) |
static <T> T |
newInstance(java.lang.String fqcn) |
static <T> T |
newInstance(java.lang.String fqcn,
java.lang.Object... args) |
public static <T> java.lang.Class<T> forName(java.lang.String fqcn)
throws UnknownClassException
context class loader, then the
current ClassLoader (Classes.class.getClassLoader()), then the system/application
ClassLoader (ClassLoader.getSystemClassLoader(), in that order. If any of them cannot locate
the specified class, an UnknownClassException is thrown (our RuntimeException equivalent of
the JRE's ClassNotFoundException.T - type of classfqcn - the fully qualified class name to loadUnknownClassException - if the class cannot be found.public static java.io.InputStream getResourceAsStream(java.lang.String name)
context class loader, then the
current ClassLoader (Classes.class.getClassLoader()), then the system/application
ClassLoader (ClassLoader.getSystemClassLoader(), in that order, using
getResourceAsStream(name).name - the name of the resource to acquire from the classloader(s).null if the resource cannot be found from any
of the three mentioned ClassLoaders.public static boolean isAvailable(java.lang.String fullyQualifiedClassName)
public static <T> T newInstance(java.lang.String fqcn)
public static <T> T newInstance(java.lang.String fqcn,
java.lang.Object... args)
public static <T> T newInstance(java.lang.Class<T> clazz)
public static <T> T newInstance(java.lang.Class<T> clazz,
java.lang.Object... args)
public static <T> java.lang.reflect.Constructor<T> getConstructor(java.lang.Class<T> clazz,
java.lang.Class... argTypes)
public static <T> T instantiate(java.lang.reflect.Constructor<T> ctor,
java.lang.Object... args)
public static <T> T loadFromService(java.lang.Class<T> clazz)
public static <T> T loadFromService(java.lang.Class<T> clazz,
java.lang.String errorMessage)
Copyright © 2018-2022 Okta. All Rights Reserved.