Here you can find the source of assertNotBlankOrThrowException(final String... strings)
Parameter | Description |
---|---|
strings | - The list of String to check. |
Parameter | Description |
---|---|
IllegalArgumentException | If at least on of the specifiedarguments 'strings' is blank or <code>null</code>. |
public static void assertNotBlankOrThrowException(final String... strings) throws IllegalArgumentException
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w . ja v a 2 s. c o m * @param strings - The list of String to check. * @throws IllegalArgumentException If at least one of the specified strings * is blank or <tt>null</tt>. * @see #assertNotBlank(String...) * @throws IllegalArgumentException If at least on of the specified * arguments 'strings' is blank or <code>null</code>. */ public static void assertNotBlankOrThrowException(final String... strings) throws IllegalArgumentException { if (!assertNotBlank(strings)) throw new IllegalArgumentException("Cannot be blank ! (null or empty)"); } /** * @param strings - The list of String to check. * @return <code>true</code> if no <tt>String</tt> is null or blank, * <code>false</code> otherwise. */ public static boolean assertNotBlank(final String... strings) { for (String s : strings) { if (s == null || s.trim().isEmpty()) return false; } return true; } }