private String parseRegex(final CharacterIterator ci) { StringBuilder regexBuffer = new StringBuilder(); int braceCount = 1; while (true) { char c = ci.next(); if (c == '{') { braceCount++; } else if (c == '}') { braceCount--; if (braceCount == 0) { break; } } regexBuffer.append(c); } return regexBuffer.toString().trim(); }
private void parse(final CharacterIterator ci) { try { while (ci.hasNext()) { char c = ci.next(); if (c == '{') { processLiteralCharacters(); parseName(ci); } else { literalCharactersBuffer.append(c); } } processLiteralCharacters(); } catch (NoSuchElementException ex) { throw new IllegalArgumentException( "Invalid syntax for the template, \"" + template + "\". Check if a path parameter is terminated with a '}'.", ex); } }
private void parse(final CharacterIterator ci) { try { while (ci.hasNext()) { char c = ci.next(); if (c == '{') { processLiteralCharacters(); parseName(ci); } else { literalCharactersBuffer.append(c); } } processLiteralCharacters(); } catch (NoSuchElementException ex) { throw new IllegalArgumentException( "Invalid syntax for the template, \"" + template + "\". Check if a path parameter is terminated with a '}'.", ex); } }
private String parseRegex(final CharacterIterator ci) { StringBuilder regexBuffer = new StringBuilder(); int braceCount = 1; while (true) { char c = ci.next(); if (c == '{') { braceCount++; } else if (c == '}') { braceCount--; if (braceCount == 0) { break; } } regexBuffer.append(c); } return regexBuffer.toString().trim(); }
private char consumeWhiteSpace(final CharacterIterator ci) { char c; do { c = ci.next(); } while (Character.isWhitespace(c)); return c; } }
private char consumeWhiteSpace(final CharacterIterator ci) { char c; do { c = ci.next(); } while (Character.isWhitespace(c)); return c; } }