Class CryptUtil

java.lang.Object
org.cryptacular.CryptUtil

public final class CryptUtil extends Object
Provides utility methods for this package.
Author:
Middleware Services
  • Method Details

    • parseInt

      public static int parseInt(String value, Predicate<Integer> require, int defaultValue)
      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 parse
      require - predicate to enforce
      defaultValue - to return if predicate is false
      Returns:
      parsed integer or default
    • assertNotNullArg

      public static <T> T assertNotNullArg(T o, String msg)
      Throws IllegalArgumentException if the supplied object is null.
      Type Parameters:
      T - type of object
      Parameters:
      o - to check
      msg - to include in the exception
      Returns:
      supplied object
    • assertNotNullArgOr

      public static <T> T assertNotNullArgOr(T o, Predicate<T> predicate, String msg)
      Throws IllegalArgumentException if the supplied object is null or the supplied predicate returns true.
      Type Parameters:
      T - type of object
      Parameters:
      o - to check
      predicate - to test
      msg - to include in the exception
      Returns:
      supplied object