Package org.seppiko.commons.utils
Class ObjectUtil
java.lang.Object
org.seppiko.commons.utils.ObjectUtil
public class ObjectUtil
extends java.lang.Object
Object Util
- Author:
- Leonard Woo
-
Constructor Summary
Constructors Constructor Description ObjectUtil() -
Method Summary
Modifier and Type Method Description static java.lang.ObjectdeepCopy(java.lang.Object obj)Deep copystatic booleanisArray(java.lang.Object obj)test object is arraystatic booleanisEmpty(java.lang.Object[] array)test object array is emptystatic <T> booleanisNull(T obj)test object is nullstatic <T> booleannotNull(T obj)test object is not nullstatic <T> TsafeNull(T t, T defaultValue)return object with defaultMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ObjectUtil
public ObjectUtil()
-
-
Method Details
-
safeNull
public static <T> T safeNull(T t, T defaultValue)return object with default- Type Parameters:
T- object type- Parameters:
t- objectdefaultValue- default- Returns:
- object result
-
isArray
public static boolean isArray(java.lang.Object obj)test object is array- Parameters:
obj- object- Returns:
- true is not null and yes
-
isEmpty
public static boolean isEmpty(java.lang.Object[] array)test object array is empty- Parameters:
array- object array- Returns:
- true is yes
-
isNull
public static <T> boolean isNull(T obj)test object is null- Type Parameters:
T- object type- Parameters:
obj- object- Returns:
- true is yes
-
notNull
public static <T> boolean notNull(T obj)test object is not null- Type Parameters:
T- object type- Parameters:
obj- object- Returns:
- true is yes
-
deepCopy
public static java.lang.Object deepCopy(java.lang.Object obj) throws java.io.IOException, java.lang.ClassNotFoundExceptionDeep copy- Parameters:
obj- source object- Returns:
- copy object
- Throws:
java.io.IOException- copy failedjava.lang.ClassNotFoundException- can not found new object
-