/** * Returns the variable names contained in the template. * * @return */ @JsonIgnore public List<String> getVariableNames() { return getUriTemplate().getVariableNames(); }
/** * Creates a new {@link DefaultCurieProvider} for the given curies using the one with the given name as default, which * means to expand unprefixed, non-IANA link relations. * * @param curies must not be {@literal null}. * @param defaultCurieName can be {@literal null}. * @since 0.19 */ public DefaultCurieProvider(Map<String, UriTemplate> curies, String defaultCurieName) { Assert.notNull(curies, "Curies must not be null!"); curies.forEach((name, template) -> { Assert.hasText(name, "Curie name must not be null or empty!"); Assert.notNull(template, "UriTemplate must not be null!"); Assert.isTrue(template.getVariableNames().size() == 1, String.format("Expected a single template variable in the UriTemplate %s!", template.toString())); }); this.defaultCurie = StringUtils.hasText(defaultCurieName) ? defaultCurieName : curies.size() == 1 ? curies.keySet().iterator().next() : null; this.curies = Collections.unmodifiableMap(curies); }
/** * Returns the variable names contained in the template. * * @return */ @JsonIgnore public List<String> getVariableNames() { return getUriTemplate().getVariableNames(); }
/** * Creates a new {@link DefaultCurieProvider} for the given curies using the one with the given name as default, which * means to expand unprefixed, non-IANA link relations. * * @param curies must not be {@literal null}. * @param defaultCurieName can be {@literal null}. * @since 0.19 */ public DefaultCurieProvider(Map<String, UriTemplate> curies, String defaultCurieName) { Assert.notNull(curies, "Curies must not be null!"); for (Entry<String, UriTemplate> entry : curies.entrySet()) { String name = entry.getKey(); UriTemplate template = entry.getValue(); Assert.hasText(name, "Curie name must not be null or empty!"); Assert.notNull(template, "UriTemplate must not be null!"); Assert.isTrue(template.getVariableNames().size() == 1, String.format("Expected a single template variable in the UriTemplate %s!", template.toString())); } this.defaultCurie = StringUtils.hasText(defaultCurieName) ? defaultCurieName : curies.size() == 1 ? curies.keySet().iterator().next() : null; this.curies = Collections.unmodifiableMap(curies); }