Class CheckParameterUtil


  • public final class CheckParameterUtil
    extends Object
    This utility class provides a collection of static helper methods for checking parameters at run-time.
    Since:
    2711
    • Method Detail

      • ensureParameterNotNull

        public static void ensureParameterNotNull​(Object value)
        Ensures a parameter is not null. Can find line number in the stack trace, so parameter name is optional
        Parameters:
        value - The parameter to check
        Throws:
        IllegalArgumentException - if the parameter is null
        Since:
        3871
      • ensureThat

        public static void ensureThat​(boolean condition,
                                      Supplier<String> messageSupplier)
        Ensures that the condition condition holds. This method can be used when the message is not a plain string literal, but somehow constructed. Using a Supplier improves the performance, as the string construction is skipped when the condition holds.
        Parameters:
        condition - The condition to check
        messageSupplier - supplier of the error message
        Throws:
        IllegalArgumentException - if the condition does not hold
        Since:
        12822