Package com.restfb.util
Klasse ObjectUtil
java.lang.Object
com.restfb.util.ObjectUtil
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic boolean
Checks is the object is a empty 'collection' or 'map'.static String
requireNotEmpty
(String obj, String errorText) Ensures thatobj
isn'tnull
or an empty string.static void
requireNotEmpty
(Collection<?> collection, String errorText) static <T extends Exception>
voidrequireNotNull
(Object obj, Supplier<T> exceptionSupplier) Ensures thatobj
isn'tnull
.static void
verifyParameterPresence
(String parameterName, Object parameter) Ensures thatparameter
isn'tnull
.static void
verifyParameterPresence
(String parameterName, String parameter) Ensures thatparameter
isn'tnull
or an empty string.
-
Methodendetails
-
requireNotEmpty
Ensures thatobj
isn'tnull
or an empty string.- Parameter:
obj
- The parameter to check.errorText
- The exception message.- Löst aus:
IllegalArgumentException
- Ifobj
isnull
or an empty string.
-
requireNotEmpty
-
requireNotNull
public static <T extends Exception> void requireNotNull(Object obj, Supplier<T> exceptionSupplier) throws T Ensures thatobj
isn'tnull
.- Parameter:
obj
- The parameter to check.exceptionSupplier
- The supplier for the exception that is thrown if obj is null.- Löst aus:
T
- Ifobj
isnull
.
-
isEmptyCollectionOrMap
Checks is the object is a empty 'collection' or 'map'.- Parameter:
obj
- the object that is checked- Gibt zurück:
true
if the given object is a empty collection or an empty map,false
otherwise
-
verifyParameterPresence
Ensures thatparameter
isn'tnull
or an empty string.- Parameter:
parameterName
- The name of the parameter (to be used in exception message).parameter
- The parameter to check.- Löst aus:
IllegalArgumentException
- Ifparameter
isnull
or an empty string.
-
verifyParameterPresence
Ensures thatparameter
isn'tnull
.- Parameter:
parameterName
- The name of the parameter (to be used in exception message).parameter
- The parameter to check.- Löst aus:
NullPointerException
- Ifparameter
isnull
.
-