Package com.alipay.sofa.common.utils
Class ClassLoaderUtil
java.lang.Object
com.alipay.sofa.common.utils.ClassLoaderUtil
- Version:
- $Id: ClassLoaderUtil.java, v 0.1 2017年08月01日 下午12:00 luoguimu123 Exp $
- Author:
- luoguimu123
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassLoader
static ClassLoader
static URL
getResource
(String resourceName) static URL
getResource
(String resourceName, Class referrer) static URL
getResource
(String resourceName, ClassLoader classLoader) static InputStream
getResourceAsStream
(String resourceName) static InputStream
getResourceAsStream
(String resourceName, Class referrer) static InputStream
getResourceAsStream
(String resourceName, ClassLoader classLoader) static URL[]
getResources
(String resourceName) static URL[]
getResources
(String resourceName, Class referrer) static URL[]
getResources
(String resourceName, ClassLoader classLoader) static Class
static Class
static Class<?>
loadClass
(String className, ClassLoader classLoader) static Class
loadServiceClass
(String serviceId) static Class
loadServiceClass
(String serviceId, Class referrer) static Class
loadServiceClass
(String serviceId, ClassLoader classLoader) static Class
loadServiceClass
(String className, String serviceId) static Class
loadServiceClass
(String className, String serviceId, Class referrer) static Class
loadServiceClass
(String className, String serviceId, ClassLoader classLoader) static Object
newInstance
(String className) static Object
newInstance
(String className, Class referrer) static Object
newInstance
(String className, ClassLoader classLoader) static Object
newServiceInstance
(String serviceId) static Object
newServiceInstance
(String serviceId, Class referrer) static Object
newServiceInstance
(String serviceId, ClassLoader classLoader) static Object
newServiceInstance
(String className, String serviceId) static Object
newServiceInstance
(String className, String serviceId, Class referrer) static Object
newServiceInstance
(String className, String serviceId, ClassLoader classLoader) static URL
whichClass
(String className) static URL
whichClass
(String className, Class referrer) static URL
whichClass
(String className, ClassLoader classLoader) static URL[]
whichClasses
(String className) static URL[]
whichClasses
(String className, Class referrer) static URL[]
whichClasses
(String className, ClassLoader classLoader)
-
Constructor Details
-
ClassLoaderUtil
public ClassLoaderUtil()
-
-
Method Details
-
getContextClassLoader
-
loadClass
- Throws:
ClassNotFoundException
-
loadClass
- Throws:
ClassNotFoundException
-
getCallerClassLoader
-
loadClass
public static Class<?> loadClass(String className, ClassLoader classLoader) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
loadServiceClass
- Throws:
ClassNotFoundException
-
loadServiceClass
public static Class loadServiceClass(String serviceId, Class referrer) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
loadServiceClass
public static Class loadServiceClass(String serviceId, ClassLoader classLoader) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
loadServiceClass
public static Class loadServiceClass(String className, String serviceId) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
loadServiceClass
public static Class loadServiceClass(String className, String serviceId, Class referrer) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
loadServiceClass
public static Class loadServiceClass(String className, String serviceId, ClassLoader classLoader) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
newInstance
- Throws:
ClassNotFoundException
-
newInstance
- Throws:
ClassNotFoundException
-
newInstance
public static Object newInstance(String className, ClassLoader classLoader) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
newServiceInstance
- Throws:
ClassNotFoundException
-
newServiceInstance
public static Object newServiceInstance(String serviceId, Class referrer) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
newServiceInstance
public static Object newServiceInstance(String serviceId, ClassLoader classLoader) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
newServiceInstance
public static Object newServiceInstance(String className, String serviceId) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
newServiceInstance
public static Object newServiceInstance(String className, String serviceId, Class referrer) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
newServiceInstance
public static Object newServiceInstance(String className, String serviceId, ClassLoader classLoader) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
getResources
-
getResources
-
getResources
-
getResource
-
getResource
-
getResource
-
getResourceAsStream
-
getResourceAsStream
-
getResourceAsStream
-
whichClasses
-
whichClasses
-
whichClasses
-
whichClass
-
whichClass
-
whichClass
-