@PrivateApi public final class ClassLoaderUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
HAZELCAST_ARRAY |
static String |
HAZELCAST_BASE_PACKAGE |
Modifier and Type | Method and Description |
---|---|
static Class<?>[] |
getAllInterfaces(Class<?> clazz) |
static <T> T |
getOrCreate(T instance,
ClassLoader classLoader,
String className)
Returns the
instance if not null, otherwise constructs a new instance of the class using
newInstance(Class, ClassLoader, String) . |
static boolean |
implementsInterfaceWithSameName(Class<?> clazz,
Class<?> iface)
Check whether given class implements an interface with the same name.
|
static boolean |
isClassAvailable(ClassLoader classLoader,
String className) |
static boolean |
isClassDefined(String className)
Indicates whether or not the given class exists
|
static boolean |
isInternalType(Class type) |
static Class<?> |
loadClass(ClassLoader classLoader,
String className) |
static <T> T |
newInstance(Class<T> klass,
ClassLoader classLoader,
String className) |
static <T> T |
newInstance(ClassLoader classLoader,
String className) |
static Class<?> |
tryLoadClass(String className)
Tries to load the given class.
|
public static final String HAZELCAST_BASE_PACKAGE
public static final String HAZELCAST_ARRAY
public static <T> T getOrCreate(T instance, ClassLoader classLoader, String className)
instance
if not null, otherwise constructs a new instance of the class using
newInstance(Class, ClassLoader, String)
.instance
- the instance of the class, can be nullclassLoader
- the classloader used for class instantiationclassName
- the name of the class being constructedinstance
or a newly constructed instance of className
public static <T> T newInstance(ClassLoader classLoader, String className) throws Exception
Exception
public static <T> T newInstance(Class<T> klass, ClassLoader classLoader, String className) throws Exception
Exception
public static Class<?> loadClass(ClassLoader classLoader, String className) throws ClassNotFoundException
ClassNotFoundException
public static boolean isClassAvailable(ClassLoader classLoader, String className)
public static boolean isInternalType(Class type)
public static Class<?> tryLoadClass(String className) throws ClassNotFoundException
className
- Name of the class to loadClassNotFoundException
- when the class is not foundpublic static boolean isClassDefined(String className)
className
- Name of the classtrue
if the class exists, false
otherwisepublic static boolean implementsInterfaceWithSameName(Class<?> clazz, Class<?> iface)
clazz
- class to check whether implements the interfaceiface
- interface to be implementedtrue
when the class implements the inteface with the same nameCopyright © 2018 Hazelcast, Inc.. All rights reserved.