public class ClassUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
CLASS_EXTENSION
class file extension.
|
static String |
JAVA_EXTENSION
java source file extension.
|
| 限定符和类型 | 方法和说明 |
|---|---|
static Boolean |
boxed(boolean v)
Boxed primitive boolean type.
|
static Byte |
boxed(byte v)
Boxed primitive byte type.
|
static Character |
boxed(char v)
Boxed primitive char type.
|
static Double |
boxed(double v)
Boxed.
|
static Float |
boxed(float v)
Boxed.
|
static Integer |
boxed(int v)
Boxed.
|
static Long |
boxed(long v)
Boxed.
|
static Object |
boxed(Object v)
Boxed.
|
static Short |
boxed(short v)
Boxed primitive short type.
|
static void |
checkBytecode(String name,
byte[] bytecode)
Check bytecode.
|
static Class<?> |
doFormName(String className)
Use Class.forname to initialize class.
|
static Class<?> |
forName(String className)
Use Class.forname to initialize class.
|
static Class<?> |
forName(String[] packages,
String className)
Use Class.forname to initialize class.
|
static Class<?> |
getBoxedClass(Class<?> type)
Get boxed class for primitive type.
|
static Class<?> |
getGenericClass(Class<?> cls)
Gets the generic class.
|
static Class<?> |
getGenericClass(Class<?> cls,
int i)
Gets the generic class.
|
static String |
getInitCode(Class<?> type)
Gets the inits the code.
|
static String |
getMethodName(Method method,
Class<?>[] parameterClasses,
String rightCode)
Gets the method name.
|
static int |
getSize(Object object)
Gets the size.
|
static String |
getSizeMethod(Class<?> cls)
Gets the size method.
|
static boolean |
isBeforeJava5(String javaVersion)
Checks if is before java 5.
|
static boolean |
isBeforeJava6(String javaVersion)
Checks if is before java 6.
|
static boolean |
isNotEmpty(Object object)
Checks if is not empty.
|
static Object |
newInstance(String name)
To new instance by class name.
|
static Method |
searchMethod(Class<?> currentClass,
String name,
Class<?>[] parameterTypes)
Search method.
|
static <K,V> Map<K,V> |
toMap(Map.Entry<K,V>[] entries)
To map.
|
static String |
toString(Throwable e)
To string.
|
static URI |
toURI(String name)
To URI.
|
static boolean |
unboxed(Boolean v)
Unboxed.
|
static byte |
unboxed(Byte v)
Unboxed.
|
static char |
unboxed(Character v)
Unboxed.
|
static double |
unboxed(Double v)
Unboxed.
|
static float |
unboxed(Float v)
Unboxed.
|
static int |
unboxed(Integer v)
Unboxed.
|
static long |
unboxed(Long v)
Unboxed.
|
static Object |
unboxed(Object v)
Unboxed.
|
static short |
unboxed(Short v)
Unboxed.
|
public static Object newInstance(String name)
name - class namepublic static Class<?> forName(String[] packages, String className)
packages - package arrayclassName - class namepublic static Class<?> forName(String className)
className - class namepublic static Class<?> doFormName(String className) throws ClassNotFoundException
className - class nameClassNotFoundException - if class not foundpublic static Class<?> getBoxedClass(Class<?> type)
type - primitive class typepublic static Boolean boxed(boolean v)
v - boolean primitive typepublic static Character boxed(char v)
v - boolean char typepublic static Byte boxed(byte v)
v - boolean byte typepublic static Short boxed(short v)
v - boolean short typepublic static Integer boxed(int v)
v - the vpublic static Long boxed(long v)
v - the vpublic static Float boxed(float v)
v - the vpublic static Double boxed(double v)
v - the vpublic static boolean unboxed(Boolean v)
v - the vpublic static char unboxed(Character v)
v - the vpublic static byte unboxed(Byte v)
v - the vpublic static short unboxed(Short v)
v - the vpublic static int unboxed(Integer v)
v - the vpublic static long unboxed(Long v)
v - the vpublic static float unboxed(Float v)
v - the vpublic static double unboxed(Double v)
v - the vpublic static boolean isNotEmpty(Object object)
object - the objectpublic static int getSize(Object object)
object - the objectpublic static Class<?> getGenericClass(Class<?> cls)
cls - the clspublic static Class<?> getGenericClass(Class<?> cls, int i)
cls - the clsi - the ipublic static boolean isBeforeJava5(String javaVersion)
javaVersion - the java versionpublic static boolean isBeforeJava6(String javaVersion)
javaVersion - the java versionpublic static void checkBytecode(String name, byte[] bytecode)
name - the namebytecode - the bytecodepublic static String getSizeMethod(Class<?> cls)
cls - the clspublic static String getMethodName(Method method, Class<?>[] parameterClasses, String rightCode)
method - the methodparameterClasses - the parameter classesrightCode - the right codepublic static Method searchMethod(Class<?> currentClass, String name, Class<?>[] parameterTypes) throws NoSuchMethodException
currentClass - the current classname - the nameparameterTypes - the parameter typesNoSuchMethodException - the no such method exceptionpublic static String getInitCode(Class<?> type)
type - the typeCopyright © 2022 Baidu, Inc.. All rights reserved.