public static void validateNotEmpty( String stringToCheck, boolean trim, String argumentName )
        throws NullArgumentException
    {
        validateNotNull( stringToCheck, argumentName );
        if( stringToCheck.length() == 0
            || ( trim && stringToCheck.trim().length() == 0 ) )
        {
            throw new NullArgumentException( argumentName + IS_EMPTY );
        }
    }
public static void validateNotEmpty ( String stringToCheck , boolean trim , String argumentName ) throws NullArgumentException { validateNotNull ( stringToCheck , argumentName ) ; if ( stringToCheck . length ( ) == 0 || ( trim && stringToCheck . trim ( ) . length ( ) == 0 ) ) { throw new NullArgumentException ( argumentName + IS_EMPTY ) ; } }
Validates that the string is not null and not an empty string.

@param stringToCheck The object to be tested.
@param trim          If the elements should be trimmed before checking if empty
@param argumentName  The name of the object, which is used to construct the exception message.

@throws NullArgumentException if the stringToCheck is either null or zero characters long.