#137 - Improved Link and UriTemplate API.

Added constructor to Link to take a UriTemplate. Added constructor to UriTemplate to take a base URI and TemplateVariables.
This commit is contained in:
Oliver Gierke
2014-01-21 14:27:17 +01:00
parent 719a4b3af3
commit 3c62de720f
2 changed files with 27 additions and 3 deletions

View File

@@ -76,6 +76,20 @@ public class UriTemplate implements Iterable<TemplateVariable> {
this.baseUri = template.substring(0, baseUriEndIndex);
}
/**
* Creates a new {@link UriTemplate} from the given base URI and {@link TemplateVariables}.
*
* @param baseUri must not be {@literal null} or empty.
* @param variables defaults to {@link TemplateVariables#NONE}.
*/
public UriTemplate(String baseUri, TemplateVariables variables) {
Assert.hasText("Base URI must not be null or empty!");
this.baseUri = baseUri;
this.variables = variables == null ? TemplateVariables.NONE : variables;
}
/**
* Returns whether the given candidate is a URI template.
*