class ValidationUtils {

    public static boolean expressionIsValidSQl( String filter )
    {
        if ( filter == null )
        {
            return true;
        }

        if ( TextUtils.containsAnyIgnoreCase( filter, ILLEGAL_SQL_KEYWORDS ) )
        {
            return false;
        }

        for ( int i = 0; i < filter.length(); i++ )
        {
            char ch = filter.charAt( i );

            if ( !(Character.isWhitespace( ch ) || Character.isLetterOrDigit( ch ) || SQL_VALID_CHARS.contains( ch )) )
            {
                return false;
            }
        }

        return true;
    }

}