Class ParamValidatorUtil
- java.lang.Object
-
- hu.icellmobilsoft.coffee.tool.utils.validation.ParamValidatorUtil
-
public class ParamValidatorUtil extends Object
Utility for function parameter validation.- Since:
- 2.3.0
- Author:
- attila.kiss
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringrequireNonBlank(String object, String paramName)Ensures that the specified parameter cannot be blankString.static <T> Collection<T>requireNonEmpty(Collection<T> object, String paramName)Ensures that the specified parameter cannot be an emptyCollection.static <T> TrequireNonEmpty(Optional<T> object, String paramName)Ensures that the specified parameter cannot be an emptyOptional.static <T> TrequireNonNull(T object, String paramName)Ensures that the specified parameter cannot benull.
-
-
-
Method Detail
-
requireNonNull
public static <T> T requireNonNull(T object, String paramName) throws hu.icellmobilsoft.coffee.dto.exception.BaseExceptionEnsures that the specified parameter cannot benull.- Type Parameters:
T- the type of the parameter- Parameters:
object- the parameterparamName- the name of the parameter- Returns:
- the not
nullparameter - Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if the parameter isnull
-
requireNonBlank
public static String requireNonBlank(String object, String paramName) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Ensures that the specified parameter cannot be blankString.- Parameters:
object- the parameterparamName- the name of the parameter- Returns:
- the non blank parameter
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if the parameter is blank
-
requireNonEmpty
public static <T> T requireNonEmpty(Optional<T> object, String paramName) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Ensures that the specified parameter cannot be an emptyOptional.- Type Parameters:
T- the type of the parameter- Parameters:
object- the parameterparamName- the name of the parameter- Returns:
- the value of the non-empty
Optional - Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if the parameter isnullor empty
-
requireNonEmpty
public static <T> Collection<T> requireNonEmpty(Collection<T> object, String paramName) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Ensures that the specified parameter cannot be an emptyCollection.- Type Parameters:
T- the type of theCollectionparameter- Parameters:
object- the parameterparamName- the name of the parameter- Returns:
- the non-empty
Collection - Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if the parameter isnullor empty
-
-