#1044 - Restore visibility of UriTemplate constructors.
Visibility must only be removed after publishing a deprecated API. See #1045 to track reducing the visibility of these constructor calls.
This commit is contained in:
@@ -57,8 +57,10 @@ public class UriTemplate implements Iterable<TemplateVariable>, Serializable {
|
||||
* Creates a new {@link UriTemplate} using the given template string.
|
||||
*
|
||||
* @param template must not be {@literal null} or empty.
|
||||
* @deprecated Migrate to {@link UriTemplate#of(String)}.
|
||||
*/
|
||||
private UriTemplate(String template) {
|
||||
@Deprecated
|
||||
public UriTemplate(String template) {
|
||||
|
||||
Assert.hasText(template, "Template must not be null or empty!");
|
||||
|
||||
@@ -100,8 +102,10 @@ public class UriTemplate implements Iterable<TemplateVariable>, Serializable {
|
||||
*
|
||||
* @param baseUri must not be {@literal null} or empty.
|
||||
* @param variables must not be {@literal null}.
|
||||
* @deprecated Migrate to {@link UriTemplate#of(String, TemplateVariables)}.
|
||||
*/
|
||||
UriTemplate(String baseUri, TemplateVariables variables) {
|
||||
@Deprecated
|
||||
public UriTemplate(String baseUri, TemplateVariables variables) {
|
||||
|
||||
Assert.hasText(baseUri, "Base URI must not be null or empty!");
|
||||
Assert.notNull(variables, "Template variables must not be null!");
|
||||
@@ -123,6 +127,19 @@ public class UriTemplate implements Iterable<TemplateVariable>, Serializable {
|
||||
return CACHE.computeIfAbsent(template, UriTemplate::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link UriTemplate} for the given {@link String} template.
|
||||
*
|
||||
* @param template must not be {@literal null} or empty.
|
||||
* @return
|
||||
*/
|
||||
public static UriTemplate of(String template, TemplateVariables variables) {
|
||||
|
||||
Assert.hasText(template, "Template must not be null or empty!");
|
||||
|
||||
return CACHE.computeIfAbsent(template, UriTemplate::new).with(variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link UriTemplate} with the current {@link TemplateVariable}s augmented with the given ones.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user