open class UriTemplate : Serializable
Represents a URI template. A URI template is a URI-like String that contains variables enclosed by braces ({}) which can be expanded to produce an actual URI.
See #expand(Map), #expand(Object[]), and #match(String) for example usages.
This class is designed to be thread-safe and reusable, allowing for any number of expand or match calls.
Author
Arjen Poutsma
Author
Juergen Hoeller
Author
Rossen Stoyanchev
Since
3.0
UriTemplate(uriTemplate: String)
Construct a new |
open fun expand(uriVariables: MutableMap<String, *>): URI
Given the Map of variables, expands this template into a URI. The Map keys represent variable names, the Map values variable values. The order of variables is not significant. Example: will print: http://example.com/hotels/Rest%20%26%20Relax/bookings/42
open fun expand(vararg uriVariableValues: Any): URI
Given an array of variables, expand this template into a full URI. The array represent variable values. The order of variables is significant. Example: will print: http://example.com/hotels/Rest%20%26%20Relax/bookings/42
|
|
open fun getVariableNames(): MutableList<String>
Return the names of the variables in the template, in order. |
|
open fun match(uri: String): MutableMap<String, String>
Match the given URI to a map of variable values. Keys in the returned map are variable names, values are variable values, as occurred in the given URI. Example: will print: {hotel=1, booking=42}
|
|
open fun matches(uri: String): Boolean
Indicate whether the given URI matches this template. |
|
open fun toString(): String |