类 ClassHelper
-
- com.alibaba.dubbo.common.utils.ClassHelper
-
public class ClassHelper extends
-
-
字段概要
字段 修饰符和类型 字段 说明 static
ARRAY_SUFFIX
Suffix for array class names: "[]"
-
构造器概要
构造器 构造器 说明 ClassHelper()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static <?>
name)
Same asClass.forName()
, except that it works for primitive types.static <?>
name, classLoader)
Replacement forClass.forName()
that also returns Class instances for primitives (like "int") and array class names (like "String[]").static <?>
name, <?> caller)
static <?>
name)
static
<?> caller)
static
getClassLoader()
Return the default ClassLoader to use: typically the thread context ClassLoader, if available; the ClassLoader that loaded the ClassUtils class will be used as fallback.static
<?> cls)
get class loaderstatic <?>
name)
Resolve the given class name as primitive class, if appropriate, according to the JVM's naming rules for primitive classes.static
obj)
-
-
-
字段详细资料
-
ARRAY_SUFFIX
public static final ARRAY_SUFFIX
Suffix for array class names: "[]"- 另请参阅:
- 常量字段值
-
-
方法详细资料
-
forNameWithThreadContextClassLoader
public static <?> forNameWithThreadContextClassLoader( name) throws
- 抛出:
-
forNameWithCallerClassLoader
public static <?> forNameWithCallerClassLoader( name, <?> caller) throws
- 抛出:
-
getCallerClassLoader
public static getCallerClassLoader(<?> caller)
-
getClassLoader
public static getClassLoader(<?> cls)
get class loader- 参数:
cls
-- 返回:
- class loader
-
getClassLoader
public static getClassLoader()
Return the default ClassLoader to use: typically the thread context ClassLoader, if available; the ClassLoader that loaded the ClassUtils class will be used as fallback.Call this method if you intend to use the thread context ClassLoader in a scenario where you absolutely need a non-null ClassLoader reference: for example, for class path resource loading (but not necessarily for
Class.forName
, which accepts anull
ClassLoader reference as well).- 返回:
- the default ClassLoader (never
null
) - 另请参阅:
-
forName
public static <?> forName( name) throws
Same asClass.forName()
, except that it works for primitive types.- 抛出:
-
forName
public static <?> forName( name, classLoader) throws ,
Replacement forClass.forName()
that also returns Class instances for primitives (like "int") and array class names (like "String[]").- 参数:
name
- the name of the ClassclassLoader
- the class loader to use (may benull
, which indicates the default class loader)- 返回:
- Class instance for the supplied name
- 抛出:
- if the class was not found
- if the class file could not be loaded
- 另请参阅:
-
resolvePrimitiveClassName
public static <?> resolvePrimitiveClassName( name)
Resolve the given class name as primitive class, if appropriate, according to the JVM's naming rules for primitive classes.Also supports the JVM's internal class names for primitive arrays. Does not support the "[]" suffix notation for primitive arrays; this is only supported by
forName(java.lang.String)
.- 参数:
name
- the name of the potentially primitive class- 返回:
- the primitive class, or
null
if the name does not denote a primitive class or primitive array class
-
toShortString
public static toShortString( obj)
-
-