public final class ObjectUtils extends Object
| 构造器和说明 |
|---|
ObjectUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
cast(Object value,
Class<T> type)
Returns target type value from origin value cast
|
static int |
compare(Object a,
Object b)
Compare two object numerically
|
static <T> void |
copy(T source,
T target,
String... fields)
Copies source fields value to target fields
|
static <T> T |
copyOf(T source,
String... fields)
Returns a new instance of copy from spec fields
|
static String |
getStackTrace() |
static String |
getStackTrace(int deepPath)
获取堆栈信息
|
static String |
getStackTrace(Thread thread) |
static Object |
getValue(Object obj,
String name)
Gets the target's name value
|
static boolean |
isComplexType(Object value)
Returns true if this object value is complex json type(Object or Array)
|
static boolean |
isEmpty(Object o)
判断对象是否为空
|
static boolean |
isNotBeanType(Class<?> type)
Returns the type is not a bean type
|
static <T> T |
newInstance(Class<T> type)
Returns a new instance of type
|
static String |
toString(Object obj)
Returns object toString
|
static String |
toString(Object obj,
String defaultStr) |
static <T> Class<T> |
typeOf(T obj) |
static byte[] |
uuid()
uuid byte array
|
static String |
uuid22()
22位uuid
|
static String |
uuid32()
uuid 32 string
|
public static String toString(Object obj)
obj - the target objectpublic static int compare(Object a, Object b)
a - the object ab - the object bpublic static <T> Class<T> typeOf(T obj)
public static boolean isComplexType(Object value)
value - the valuetrue if the value is complex json typepublic static boolean isEmpty(Object o)
o - the objecttrue is emptypublic static Object getValue(Object obj, String name)
obj - the objectname - the field namepublic static <T> T cast(Object value, Class<T> type)
value - source objecttype - target object typecom.alibaba.fastjson.util.TypeUtils#castToInt(Object)public static byte[] uuid()
public static String uuid32()
public static String uuid22()
public static String getStackTrace(int deepPath)
deepPath - the deep pathpublic static String getStackTrace()
public static <T> void copy(T source,
T target,
String... fields)
source - the sourcetarget - the targetfields - the fields of String arraypublic static <T> T copyOf(T source,
String... fields)
source - the sourcefields - the fieldspublic static <T> T newInstance(Class<T> type)
type - the type classpublic static boolean isNotBeanType(Class<?> type)
type - the type classtrue assert is not a bean typeCopyright © 2023. All rights reserved.