java.lang.Object
org.seppiko.commons.utils.ObjectUtil
Object Util
- Author:
- Leonard Woo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectDeep copystatic Object[]getSuppliers(Supplier<?>[] suppliers) Get Supplier object with not null arraystatic <T> booleanisArray(T obj) test object is arraystatic <T> booleanisEmpty(T[] array) test object array is emptystatic <T> booleanisNull(T obj) test object is nullstatic <T> booleanisNull(T[] obj) test object array is nullstatic <T> booleannotNull(T obj) test object is not nullstatic <T> booleannotNull(T[] obj) test object array is not null
-
Constructor Details
-
ObjectUtil
public ObjectUtil()
-
-
Method Details
-
isArray
public static <T> boolean isArray(T obj) test object is array- Type Parameters:
T- object type- Parameters:
obj- object- Returns:
- true is not null and it's array object
-
isEmpty
public static <T> boolean isEmpty(T[] array) test object array is empty- Type Parameters:
T- object type- Parameters:
array- object array- Returns:
- true is null or empty
-
isNull
public static <T> boolean isNull(T obj) test object is null- Type Parameters:
T- object type- Parameters:
obj- object- Returns:
- true is null
-
isNull
public static <T> boolean isNull(T[] obj) test object array is null- Type Parameters:
T- object type- Parameters:
obj- object array- Returns:
- true is null
-
notNull
public static <T> boolean notNull(T obj) test object is not null- Type Parameters:
T- object type- Parameters:
obj- object- Returns:
- true is not null
-
notNull
public static <T> boolean notNull(T[] obj) test object array is not null- Type Parameters:
T- object type- Parameters:
obj- object array- Returns:
- true is not null
-
deepCopy
public static Object deepCopy(Object obj) throws IOException, ReflectiveOperationException, SecurityException, NullPointerException Deep copy- Parameters:
obj- source object- Returns:
- copy object
- Throws:
IOException- copy failedReflectiveOperationException- object cannot be foundSecurityException- if the stream header is incorrectNullPointerException- object is null
-
getSuppliers
Get Supplier object with not null array- Parameters:
suppliers- supplier array- Returns:
- object array
- Throws:
NullPointerException- supplier array is null
-