/** * Converts a place token to an unescaped string. If the name token or the parameters contain any * of the separator symbols, they will be escaped with our custom escaping mechanism. * * @param placeRequest The place request to convert. * @return The unescaped string for the place token corresponding to that place request. * @throws TokenFormatException if there is an error converting. */ private String placeTokenToUnescapedString(PlaceRequest placeRequest) throws TokenFormatException { StringBuilder out = new StringBuilder(); out.append(customEscape(placeRequest.getNameToken())); Set<String> params = placeRequest.getParameterNames(); if (params != null) { for (String name : params) { out.append(paramSeparator).append(customEscape(name)).append(valueSeparator).append( customEscape(placeRequest.getParameter(name, null))); } } return out.toString(); }