protected List<String> parseCommaSeparatedList(String s) {
    List<String> result = new ArrayList<String>();
    if (s != null && !"".equals(s)) {

      StringCharacterIterator iterator = new StringCharacterIterator(s);
      char c = iterator.first();

      StringBuilder strb = new StringBuilder();
      boolean insideExpression = false;

      while (c != StringCharacterIterator.DONE) {
        if (c == '{' || c == '$') {
          insideExpression = true;
        } else if (c == '}') {
          insideExpression = false;
        } else if (c == ',' && !insideExpression) {
          result.add(strb.toString().trim());
          strb.delete(0, strb.length());
        }

        if (c != ',' || (insideExpression)) {
          strb.append(c);
        }

        c = iterator.next();
      }

      if (strb.length() > 0) {
        result.add(strb.toString().trim());
      }

    }
    return result;
  }
protected List < String > parseCommaSeparatedList ( String s ) { List < String > result = new ArrayList < String > ( ) ; if ( s != null && ! "" . equals ( s ) ) { StringCharacterIterator iterator = new StringCharacterIterator ( s ) ; char c = iterator . first ( ) ; StringBuilder strb = new StringBuilder ( ) ; boolean insideExpression = false ; while ( c != StringCharacterIterator . DONE ) { if ( c == '{' || c == '$' ) { insideExpression = true ; } else if ( c == '}' ) { insideExpression = false ; } else if ( c == ',' && ! insideExpression ) { result . add ( strb . toString ( ) . trim ( ) ) ; strb . delete ( 0 , strb . length ( ) ) ; } if ( c != ',' || ( insideExpression ) ) { strb . append ( c ) ; } c = iterator . next ( ) ; } if ( strb . length ( ) > 0 ) { result . add ( strb . toString ( ) . trim ( ) ) ; } } return result ; }
Parses the given String as a list of comma separated entries, where an
entry can possibly be an expression that has comma's.

If somebody is smart enough to write a regex for this, please let us know.

@return the entries of the comma separated list, trimmed.