Package org.cryptacular
Class CryptUtil
java.lang.Object
org.cryptacular.CryptUtil
Provides utility methods for this package.
- Author:
- Middleware Services
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TassertNotNullArg(T o, String msg) ThrowsIllegalArgumentExceptionif the supplied object is null.static <T> TassertNotNullArgOr(T o, Predicate<T> predicate, String msg) ThrowsIllegalArgumentExceptionif the supplied object is null or the supplied predicate returns true.static intParse the supplied value as an integer.
-
Method Details
-
parseInt
Parse the supplied value as an integer. Returns the default value if the predicate is not met or if the value cannot be parsed.- Parameters:
value- to parserequire- predicate to enforcedefaultValue- to return if predicate is false- Returns:
- parsed integer or default
-
assertNotNullArg
ThrowsIllegalArgumentExceptionif the supplied object is null.- Type Parameters:
T- type of object- Parameters:
o- to checkmsg- to include in the exception- Returns:
- supplied object
-
assertNotNullArgOr
ThrowsIllegalArgumentExceptionif the supplied object is null or the supplied predicate returns true.- Type Parameters:
T- type of object- Parameters:
o- to checkpredicate- to testmsg- to include in the exception- Returns:
- supplied object
-