Class ArgumentNotValid

    • Constructor Summary

      Constructors 
      Constructor Description
      ArgumentNotValid​(java.lang.String message)
      Constructs new ArgumentNotValid with the specified detail message.
      ArgumentNotValid​(java.lang.String message, java.lang.Throwable cause)
      Constructs new ArgumentNotValid with the specified detail message and cause.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void checkExistsDirectory​(java.io.File aDir, java.lang.String name)
      Check, if the given argument is an existing directory.
      static void checkExistsNormalFile​(java.io.File aFile, java.lang.String name)
      Check, if the given argument is an existing normal file.
      static void checkNotNegative​(int num, java.lang.String name)
      Check if an int argument is less than 0.
      static void checkNotNegative​(long num, java.lang.String name)
      Check if a long argument is less than 0.
      static void checkNotNull​(java.lang.Object val, java.lang.String name)
      Check if an Object argument is null.
      static void checkNotNullOrEmpty​(java.lang.String val, java.lang.String name)
      Check if a String argument is null or the empty string.
      static void checkNotNullOrEmpty​(java.util.Collection<?> c, java.lang.String name)
      Check if a List argument is not null and the list is not empty.
      static void checkPositive​(int num, java.lang.String name)
      Check if an int argument is less than or equal to 0.
      static void checkPositive​(long num, java.lang.String name)
      Check if a long argument is less than 0.
      static void checkTrue​(boolean b, java.lang.String s)
      Check that some condition on input parameters is true and throw an ArgumentNotValid if it is false.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ArgumentNotValid

        public ArgumentNotValid​(java.lang.String message)
        Constructs new ArgumentNotValid with the specified detail message.
        Parameters:
        message - The detail message
      • ArgumentNotValid

        public ArgumentNotValid​(java.lang.String message,
                                java.lang.Throwable cause)
        Constructs new ArgumentNotValid with the specified detail message and cause.
        Parameters:
        message - The detail message
        cause - The cause
    • Method Detail

      • checkNotNullOrEmpty

        public static void checkNotNullOrEmpty​(java.lang.String val,
                                               java.lang.String name)
        Check if a String argument is null or the empty string.
        Parameters:
        val - the value to check
        name - the name and type of the value being checked
        Throws:
        ArgumentNotValid - if test fails
      • checkNotNull

        public static void checkNotNull​(java.lang.Object val,
                                        java.lang.String name)
        Check if an Object argument is null.
        Parameters:
        val - the value to check
        name - the name and type of the value being checked.
        Throws:
        ArgumentNotValid - if test fails
      • checkNotNegative

        public static void checkNotNegative​(int num,
                                            java.lang.String name)
        Check if an int argument is less than 0.
        Parameters:
        num - argument to check
        name - the name and type of the value being checked.
        Throws:
        ArgumentNotValid - if test fails
      • checkNotNegative

        public static void checkNotNegative​(long num,
                                            java.lang.String name)
        Check if a long argument is less than 0.
        Parameters:
        num - argument to check
        name - the name and type of the value being checked.
        Throws:
        ArgumentNotValid - if test fails
      • checkPositive

        public static void checkPositive​(int num,
                                         java.lang.String name)
        Check if an int argument is less than or equal to 0.
        Parameters:
        num - argument to check
        name - the name and type of the value being checked.
        Throws:
        ArgumentNotValid - if test fails
      • checkPositive

        public static void checkPositive​(long num,
                                         java.lang.String name)
        Check if a long argument is less than 0.
        Parameters:
        num - argument to check
        name - the name and type of the value being checked.
        Throws:
        ArgumentNotValid - if test fails
      • checkNotNullOrEmpty

        public static void checkNotNullOrEmpty​(java.util.Collection<?> c,
                                               java.lang.String name)
        Check if a List argument is not null and the list is not empty.
        Parameters:
        c - argument to check
        name - the name and type of the value being checked.
        Throws:
        ArgumentNotValid - if test fails
      • checkTrue

        public static void checkTrue​(boolean b,
                                     java.lang.String s)
        Check that some condition on input parameters is true and throw an ArgumentNotValid if it is false.
        Parameters:
        b - the condition to check
        s - the error message to be reported
        Throws:
        ArgumentNotValid - if b is false
      • checkExistsDirectory

        public static void checkExistsDirectory​(java.io.File aDir,
                                                java.lang.String name)
        Check, if the given argument is an existing directory.
        Parameters:
        aDir - a given File object.
        name - Name of object
        Throws:
        ArgumentNotValid - If aDir is not an existing directory
      • checkExistsNormalFile

        public static void checkExistsNormalFile​(java.io.File aFile,
                                                 java.lang.String name)
        Check, if the given argument is an existing normal file.
        Parameters:
        aFile - a given File object.
        name - Name of object
        Throws:
        ArgumentNotValid - If aDir is not an existing file