@Override public String toTemplate() { return buildString(new HashMap<String, Object>(), true, true, true); }
protected URI buildUriFromMap(Map<String, ? extends Object> paramMap, boolean fromEncodedMap, boolean encodeSlash) throws IllegalArgumentException, UriBuilderException { String buf = buildString(paramMap, fromEncodedMap, false, encodeSlash); try { return URI.create(buf); } catch (Exception e) { throw new RuntimeException(Messages.MESSAGES.failedToCreateUri(buf), e); } }
@Override public UriBuilder resolveTemplate(String name, Object value, boolean encodeSlashInPath) throws IllegalArgumentException { if (name == null) throw new IllegalArgumentException(Messages.MESSAGES.nameParamIsNull()); if (value == null) throw new IllegalArgumentException(Messages.MESSAGES.valueParamIsNull()); HashMap<String, Object> vals = new HashMap<String, Object>(); vals.put(name, value); String str = buildString(vals, false, true, encodeSlashInPath); return fromTemplate(str); }
@Override public UriBuilder resolveTemplateFromEncoded(String name, Object value) throws IllegalArgumentException { if (name == null) throw new IllegalArgumentException(Messages.MESSAGES.nameParamIsNull()); if (value == null) throw new IllegalArgumentException(Messages.MESSAGES.valueParamIsNull()); HashMap<String, Object> vals = new HashMap<String, Object>(); vals.put(name, value); String str = buildString(vals, true, true, true); return fromTemplate(str); }
@Override public UriBuilder resolveTemplates(Map<String, Object> templateValues) throws IllegalArgumentException { if (templateValues == null) throw new IllegalArgumentException(Messages.MESSAGES.templateValuesParamNull()); if (templateValues.containsKey(null)) throw new IllegalArgumentException(Messages.MESSAGES.mapKeyNull()); String str = buildString(templateValues, false, true, true); return fromTemplate(str); }
@Override public UriBuilder resolveTemplates(Map<String, Object> templateValues, boolean encodeSlashInPath) throws IllegalArgumentException { if (templateValues == null) throw new IllegalArgumentException(Messages.MESSAGES.templateValuesParamNull()); if (templateValues.containsKey(null)) throw new IllegalArgumentException(Messages.MESSAGES.mapKeyNull()); String str = buildString(templateValues, false, true, encodeSlashInPath); return fromTemplate(str); }
@Override public UriBuilder resolveTemplatesFromEncoded(Map<String, Object> templateValues) throws IllegalArgumentException { if (templateValues == null) throw new IllegalArgumentException(Messages.MESSAGES.templateValuesParamNull()); if (templateValues.containsKey(null)) throw new IllegalArgumentException(Messages.MESSAGES.mapKeyNull()); String str = buildString(templateValues, true, true, true); return fromTemplate(str); } }
protected URI buildFromValues(boolean encodeSlash, boolean encoded, Object... values) { String buf = null; try { buf = buildString(new URITemplateParametersMap(values), encoded, false, encodeSlash); return new URI(buf); //return URI.create(buf); } catch (IllegalArgumentException iae) { throw iae; } catch (Exception e) { throw new UriBuilderException(Messages.MESSAGES.failedToCreateUri(buf), e); } }