ClassUtilspublic class ClassHelper extends Object
ClassUtils| 构造器和说明 |
|---|
ClassHelper()
已过时。
|
| 限定符和类型 | 方法和说明 |
|---|---|
static Object |
convertPrimitive(Class<?> type,
String value)
已过时。
|
static Class<?> |
forName(String name)
已过时。
Same as
Class.forName(), except that it works for primitive
types. |
static Class<?> |
forName(String name,
ClassLoader classLoader)
已过时。
Replacement for
Class.forName() that also returns Class
instances for primitives (like "int") and array class names (like
"String[]"). |
static Class<?> |
forNameWithCallerClassLoader(String name,
Class<?> caller)
已过时。
|
static Class<?> |
forNameWithThreadContextClassLoader(String name)
已过时。
|
static ClassLoader |
getCallerClassLoader(Class<?> caller)
已过时。
|
static ClassLoader |
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 ClassLoader |
getClassLoader(Class<?> clazz)
已过时。
get class loader
|
static boolean |
isGetter(Method method)
已过时。
Replace to
MethodUtils#isGetter(Method) |
static boolean |
isPrimitive(Class<?> type)
已过时。
|
static boolean |
isSetter(Method method)
已过时。
Replace to
MethodUtils#isSetter(Method) |
static boolean |
isTypeMatch(Class<?> type,
String value)
已过时。
We only check boolean value at this moment.
|
static Class<?> |
resolvePrimitiveClassName(String name)
已过时。
Resolve the given class name as primitive class, if appropriate,
according to the JVM's naming rules for primitive classes.
|
static String |
simpleClassName(Class<?> clazz)
已过时。
|
static String |
toShortString(Object obj)
已过时。
|
public static Class<?> forNameWithThreadContextClassLoader(String name) throws ClassNotFoundException
public static Class<?> forNameWithCallerClassLoader(String name, Class<?> caller) throws ClassNotFoundException
public static ClassLoader getCallerClassLoader(Class<?> caller)
public static ClassLoader getClassLoader(Class<?> clazz)
clazz - public static ClassLoader getClassLoader()
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 a null ClassLoader
reference as well).
null)Thread.getContextClassLoader()public static Class<?> forName(String name) throws ClassNotFoundException
Class.forName(), except that it works for primitive
types.public static Class<?> forName(String name, ClassLoader classLoader) throws ClassNotFoundException, LinkageError
Class.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 be null,
which indicates the default class loader)ClassNotFoundException - if the class was not foundLinkageError - if the class file could not be loadedClass.forName(String, boolean, ClassLoader)public static Class<?> resolvePrimitiveClassName(String name)
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 classnull if the name does not
denote a primitive class or primitive array classpublic static boolean isSetter(Method method)
MethodUtils#isSetter(Method)public static boolean isGetter(Method method)
MethodUtils#isGetter(Method)(Method)public static boolean isPrimitive(Class<?> type)
Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.