Class Argument

    • Method Detail

      • requireNonNull

        public static <T> T requireNonNull​(T object,
                                           String message)
        Tests for null and throws IllegalArgumentException when null.
        Type Parameters:
        T - The type
        Parameters:
        object - The object to test.
        message - The message when it is null.
        Returns:
        The object instance when non-null.
      • requirePositive

        public static void requirePositive​(int amount,
                                           String message)
        Tests if the given integer is positive.
        Parameters:
        amount - The amount to test.
        message - The message when the amount is negative.
      • requireWithinBounds

        public static void requireWithinBounds​(int amount,
                                               int lowerLimit,
                                               int upperLimit,
                                               Supplier<String> message)
        Tests if the given amount is within the bounds.
        Parameters:
        amount - The amount to test
        lowerLimit - The lower limit (inclusive)
        upperLimit - The upper limit (exclusive)
      • requireWithinBounds

        @Deprecated
        public static void requireWithinBounds​(int amount,
                                               int lowerLimit,
                                               int upperLimit,
                                               String message)
        Tests if the given amount is within the bounds.
        Parameters:
        amount - The amount to test
        lowerLimit - The lower limit (inclusive)
        upperLimit - The upper limit (exclusive)