public static void isFile ( File parameter , String name ) throws IllegalArgumentException { if ( parameter == null || ! parameter . exists ( ) || parameter . isDirectory ( ) ) { throw new IllegalArgumentException ( String . format ( "%s |%s| is missing or is a directory." , name , parameter . getAbsolutePath ( ) ) ) ; } }
Check if file parameter is an existing ordinary file not a directory . This validator throws illegal argument if given file does not exist or is not an ordinary file .