public class UriMatchTemplate extends UriTemplate implements UriMatcher
UriTemplate
and adds the ability to match a URI to a given template using the
UriMatcher.match(java.net.URI)
method.Modifier and Type | Class and Description |
---|---|
protected static class |
UriMatchTemplate.DefaultUriMatchInfo
The default
UriMatchInfo implementation. |
protected static class |
UriMatchTemplate.UriMatchTemplateParser
Extended version of
UriTemplate.UriTemplateParser that builds a regular expression to match a path. |
UriTemplate.PathSegment, UriTemplate.UriTemplateParser
Modifier and Type | Field and Description |
---|---|
protected StringBuilder |
pattern |
protected static String |
VARIABLE_MATCH_PATTERN |
protected List<UriMatchVariable> |
variables |
Modifier | Constructor and Description |
---|---|
|
UriMatchTemplate(CharSequence templateString)
Construct a new URI template for the given template.
|
protected |
UriMatchTemplate(CharSequence templateString,
List<UriTemplate.PathSegment> segments,
Pattern matchPattern,
List<UriMatchVariable> variables) |
protected |
UriMatchTemplate(CharSequence templateString,
Object... parserArguments)
Construct a new URI template for the given template.
|
Modifier and Type | Method and Description |
---|---|
protected UriTemplate.UriTemplateParser |
createParser(String templateString,
Object... parserArguments)
Creates a parser.
|
List<String> |
getVariableNames() |
List<UriMatchVariable> |
getVariables() |
Optional<UriMatchInfo> |
match(String uri)
Match the given URI string.
|
UriMatchTemplate |
nest(CharSequence uriTemplate)
Nests another URI template with this template.
|
protected UriMatchTemplate |
newUriMatchTemplate(CharSequence uriTemplate,
List<UriTemplate.PathSegment> newSegments,
Pattern newPattern,
List<UriMatchVariable> variables) |
protected UriTemplate |
newUriTemplate(CharSequence uriTemplate,
List<UriTemplate.PathSegment> newSegments) |
static UriMatchTemplate |
of(String uri)
Create a new
UriTemplate for the given URI. |
String |
toPathString()
Returns the path string excluding any query variables.
|
buildNestedSegments, compareTo, equals, expand, expand, hashCode, nest, normalizeNested, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
match
protected static final String VARIABLE_MATCH_PATTERN
protected StringBuilder pattern
protected List<UriMatchVariable> variables
public UriMatchTemplate(CharSequence templateString)
templateString
- The template stringprotected UriMatchTemplate(CharSequence templateString, Object... parserArguments)
templateString
- The template stringparserArguments
- The parsed argumentsprotected UriMatchTemplate(CharSequence templateString, List<UriTemplate.PathSegment> segments, Pattern matchPattern, List<UriMatchVariable> variables)
templateString
- The templatesegments
- The list of segmentsmatchPattern
- The match patternvariables
- The variablesprotected UriMatchTemplate newUriMatchTemplate(CharSequence uriTemplate, List<UriTemplate.PathSegment> newSegments, Pattern newPattern, List<UriMatchVariable> variables)
uriTemplate
- The templatenewSegments
- The list of new segmentsnewPattern
- The list of new pattersvariables
- The variablesUriMatchTemplate
public List<String> getVariableNames()
public List<UriMatchVariable> getVariables()
public String toPathString()
public Optional<UriMatchInfo> match(String uri)
match
in interface UriMatcher
uri
- The uRIpublic UriMatchTemplate nest(CharSequence uriTemplate)
UriTemplate
nest
in class UriTemplate
uriTemplate
- The URI template. If it does not begin with forward slash it will automatically be appended with forward slashpublic static UriMatchTemplate of(String uri)
UriTemplate
for the given URI.uri
- The URIprotected UriTemplate newUriTemplate(CharSequence uriTemplate, List<UriTemplate.PathSegment> newSegments)
newUriTemplate
in class UriTemplate
uriTemplate
- The URI templatenewSegments
- The new segmentsUriTemplate
protected UriTemplate.UriTemplateParser createParser(String templateString, Object... parserArguments)
UriTemplate
createParser
in class UriTemplate
templateString
- The templateparserArguments
- The parsed arguments