Class Preconditions


  • public class Preconditions
    extends Object
    Author:
    Jozef Hartinger
    • Method Detail

      • checkArgumentNotNull

        public static void checkArgumentNotNull​(Object reference,
                                                String argumentName)
        Throws IllegalArgumentException with an appropriate message if the reference is null.
        Parameters:
        reference - the reference to be checked
        argumentName - name of the argument that is being checked. The name used in the error message.
      • checkArgumentNotNull

        public static void checkArgumentNotNull​(Object reference)
        Throws IllegalArgumentException if the reference is null. This method should only be used for methods with single argument.
        Parameters:
        reference - the reference to be checked
      • checkNotNull

        public static void checkNotNull​(Object reference)
        Parameters:
        reference - The reference to be checked
        Throws:
        NullPointerException - if the reference is null
      • checkArgument

        public static void checkArgument​(boolean condition,
                                         Object argument)
      • checkArgument

        public static void checkArgument​(boolean condition,
                                         String message)