@Test public void testSettingTwoQueryParameter() throws Exception { final UriTemplate tmpl = new UriTemplate("/test{?query,other}"); final Map<String, String> values = new HashMap<String, String>(); values.put("query", "example"); values.put("other", "otherExample"); final String uri = tmpl.createURI(values); assertEquals( "query string is not set", "/test?query=example&other=otherExample", uri ); }
public final String createURI(final Map<String, String> values) { final StringBuilder sb = new StringBuilder(); resolveTemplate(normalizedTemplate, sb, new TemplateValueStrategy() { @Override public String valueFor(String templateVariable, String matchedGroup) { return values.get(templateVariable); } }); return sb.toString(); }
UriTemplate { public final String createURI(final Map<String, String> values) { final StringBuilder sb = new StringBuilder(); resolveTemplate(normalizedTemplate, sb, new TemplateValueStrategy() { @Override public String valueFor(String templateVariable, String matchedGroup) { return values.get(templateVariable); } }); return sb.toString(); } }
UriTemplate { public final String createURI(final Map<String, String> values) { final StringBuilder sb = new StringBuilder(); resolveTemplate(normalizedTemplate, sb, new TemplateValueStrategy() { @Override public String valueFor(String templateVariable, String matchedGroup) { return values.get(templateVariable); } }); return sb.toString(); } private  UriTemplate(); @SuppressWarnings("DuplicateThrows")  UriTemplate(String template); @SuppressWarnings("DuplicateThrows") protected  UriTemplate(UriTemplateParser templateParser); }
UriTemplate { public final String createURI(final Map<String, String> values) { final StringBuilder sb = new StringBuilder(); resolveTemplate(normalizedTemplate, sb, new TemplateValueStrategy() { @Override public String valueFor(String templateVariable, String matchedGroup) { return values.get(templateVariable); } }); return sb.toString(); } private  UriTemplate(); @SuppressWarnings("DuplicateThrows")  UriTemplate(String template); @SuppressWarnings("DuplicateThrows") protected  UriTemplate(UriTemplateParser templateParser); static URI resolve(final URI baseUri, String refUri); static URI resolve(final URI baseUri, URI refUri); static URI normalize(final String uri); static URI normalize(final URI uri); static URI relativize(URI baseUri, URI refUri); final String getTemplate(); final PatternWithGroups getPattern(); @SuppressWarnings("UnusedDeclaration") final boolean endsWithSlash(); final List<String> getTemplateVariables(); @SuppressWarnings("UnusedDeclaration") final boolean isTemplateVariablePresent(String name); final int getNumberOfExplicitRegexes(); final int getNumberOfRegexGroups(); final int getNumberOfExplicitCharacters(); final int getNumberOfTemplateVariables(); final boolean match(CharSequence uri, Map<String, String> templateVariableToValue); final boolean match(CharSequence uri, List<String> groupValues); final String createURI(final Map<String, String> values); final String createURI(String... values); final String createURI(final String[] values, final int offset, final int length); @Override final String toString(); @Override final int hashCode(); @Override final boolean equals(Object o); static String createURI(
            final String scheme, String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final Map<String, ?> values, final boolean encode, final boolean encodeSlashInPath); static String createURIWithStringValues(
            final String scheme, final String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final Map<String, ?> values, final boolean encode, final boolean encodeSlashInPath); static String createURI(
            final String scheme, String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final Object[] values, final boolean encode, final boolean encodeSlashInPath); static String createURIWithStringValues(
            final String scheme, final String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final String[] values, final boolean encode, final boolean encodeSlashInPath); @SuppressWarnings("unchecked") static String resolveTemplateValues(final UriComponent.Type type,
                                               String template,
                                               final boolean encode,
                                               final Map<String, ?> _mapValues); }
UriTemplate { public final String createURI(final Map<String, String> values) { final StringBuilder sb = new StringBuilder(); resolveTemplate(normalizedTemplate, sb, new TemplateValueStrategy() { @Override public String valueFor(String templateVariable, String matchedGroup) { return values.get(templateVariable); } }); return sb.toString(); } private  UriTemplate(); @SuppressWarnings("DuplicateThrows")  UriTemplate(String template); @SuppressWarnings("DuplicateThrows") protected  UriTemplate(UriTemplateParser templateParser); static URI resolve(final URI baseUri, String refUri); static URI resolve(final URI baseUri, URI refUri); static URI normalize(final String uri); static URI normalize(final URI uri); static URI relativize(URI baseUri, URI refUri); final String getTemplate(); final PatternWithGroups getPattern(); @SuppressWarnings("UnusedDeclaration") final boolean endsWithSlash(); final List<String> getTemplateVariables(); @SuppressWarnings("UnusedDeclaration") final boolean isTemplateVariablePresent(String name); final int getNumberOfExplicitRegexes(); final int getNumberOfRegexGroups(); final int getNumberOfExplicitCharacters(); final int getNumberOfTemplateVariables(); final boolean match(CharSequence uri, Map<String, String> templateVariableToValue); final boolean match(CharSequence uri, List<String> groupValues); final String createURI(final Map<String, String> values); final String createURI(String... values); final String createURI(final String[] values, final int offset, final int length); @Override final String toString(); @Override final int hashCode(); @Override final boolean equals(Object o); static String createURI(
            final String scheme, String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final Map<String, ?> values, final boolean encode, final boolean encodeSlashInPath); static String createURIWithStringValues(
            final String scheme, final String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final Map<String, ?> values, final boolean encode, final boolean encodeSlashInPath); static String createURI(
            final String scheme, String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final Object[] values, final boolean encode, final boolean encodeSlashInPath); static String createURIWithStringValues(
            final String scheme, final String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final String[] values, final boolean encode, final boolean encodeSlashInPath); @SuppressWarnings("unchecked") static String resolveTemplateValues(final UriComponent.Type type,
                                               String template,
                                               final boolean encode,
                                               final Map<String, ?> _mapValues); static final Comparator<UriTemplate> COMPARATOR; static final UriTemplate EMPTY; }