private List<String> split(String prefix){
  List<String> parts=new ArrayList<String>();
  int bracketCount=0;
  boolean inquotes=false;
  int lastIndex=0;
  for (int i=0; i < prefix.length(); i++) {
    char c=prefix.charAt(i);
    if (c == '[') {
      bracketCount++;
      continue;
    }
 else     if (c == '"') {
      inquotes=!inquotes;
      continue;
    }
 else     if (c == ']') {
      bracketCount--;
      if (bracketCount < 0) {
        throw new RuntimeException("Malformed prefix: " + prefix);
      }
      continue;
    }
    if (c == ':' && !inquotes && bracketCount == 0) {
      parts.add(prefix.substring(lastIndex,i));
      lastIndex=i + 1;
    }
  }
  if (lastIndex < prefix.length() - 1 && !inquotes && bracketCount == 0) {
    parts.add(prefix.substring(lastIndex));
  }
  return parts;
}

private List < String > split ( String prefix ) { List < String > parts = new ArrayList < String > ( ) ; int bracketCount = 0 ; boolean inquotes = false ; int lastIndex = 0 ; for ( int i = 0 ; i < prefix . length ( ) ; i ++ ) { char c = prefix . charAt ( i ) ; if ( c == '[' ) { bracketCount ++ ; continue ; } else if ( c == '"' ) { inquotes = ! inquotes ; continue ; } else if ( c == ']' ) { bracketCount -- ; if ( bracketCount < 0 ) { throw new RuntimeException ( "Malformed prefix: " + prefix ) ; } continue ; } if ( c == ':' && ! inquotes && bracketCount == 0 ) { parts . add ( prefix . substring ( lastIndex , i ) ) ; lastIndex = i + 1 ; } } if ( lastIndex < prefix . length ( ) - 1 && ! inquotes && bracketCount == 0 ) { parts . add ( prefix . substring ( lastIndex ) ) ; } return parts ; }
given some dot separated prefix , split on the colons that are not within quotes , and not within brackets .
