public String next(String expression) {
    if (expression == null || expression.length() == 0) { return null; }
    boolean indexed = false;
    boolean mapped = false;
    for (int i = 0; i < expression.length(); i++) {
      char c = expression.charAt(i);
      if (indexed) {
        if (c == IndexedEnd) { return expression.substring(0, i + 1); }
      } else if (mapped) {
        if (c == MappedEnd) { return expression.substring(0, i + 1); }
      } else {
        if (c == Nested) {
          return expression.substring(0, i);
        } else if (c == MappedStart) {
          mapped = true;
        } else if (c == IndexedStart) {
          indexed = true;
        }
      }
    }
    return expression;
  }
public String next ( String expression ) { if ( expression == null || expression . length ( ) == 0 ) { return null ; } boolean indexed = false ; boolean mapped = false ; for ( int i = 0 ; i < expression . length ( ) ; i ++ ) { char c = expression . charAt ( i ) ; if ( indexed ) { if ( c == IndexedEnd ) { return expression . substring ( 0 , i + 1 ) ; } } else if ( mapped ) { if ( c == MappedEnd ) { return expression . substring ( 0 , i + 1 ) ; } } else { if ( c == Nested ) { return expression . substring ( 0 , i ) ; } else if ( c == MappedStart ) { mapped = true ; } else if ( c == IndexedStart ) { indexed = true ; } } } return expression ; }
Extract the next property expression from the current expression.

@param expression The property expression
@return The next property expression