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 java.lang.StringBuilder |
pattern |
protected static java.lang.String |
VARIABLE_MATCH_PATTERN |
protected java.util.List<UriMatchVariable> |
variables |
Modifier | Constructor and Description |
---|---|
|
UriMatchTemplate(java.lang.CharSequence templateString)
Construct a new URI template for the given template.
|
protected |
UriMatchTemplate(java.lang.CharSequence templateString,
java.util.List<UriTemplate.PathSegment> segments,
java.util.regex.Pattern matchPattern,
java.util.List<UriMatchVariable> variables) |
protected |
UriMatchTemplate(java.lang.CharSequence templateString,
java.lang.Object... parserArguments)
Construct a new URI template for the given template.
|
Modifier and Type | Method and Description |
---|---|
protected UriTemplate.UriTemplateParser |
createParser(java.lang.String templateString,
java.lang.Object... parserArguments)
Creates a parser.
|
java.util.List<java.lang.String> |
getVariableNames() |
java.util.List<UriMatchVariable> |
getVariables() |
java.util.Optional<UriMatchInfo> |
match(java.lang.String uri)
Match the given URI string.
|
UriMatchTemplate |
nest(java.lang.CharSequence uriTemplate)
Nests another URI template with this template.
|
protected UriMatchTemplate |
newUriMatchTemplate(java.lang.CharSequence uriTemplate,
java.util.List<UriTemplate.PathSegment> newSegments,
java.util.regex.Pattern newPattern,
java.util.List<UriMatchVariable> variables) |
protected UriTemplate |
newUriTemplate(java.lang.CharSequence uriTemplate,
java.util.List<UriTemplate.PathSegment> newSegments) |
static UriMatchTemplate |
of(java.lang.String uri)
Create a new
UriTemplate for the given URI. |
java.lang.String |
toPathString()
Returns the path string excluding any query variables.
|
buildNestedSegments, compareTo, equals, expand, expand, getPathVariableSegmentCount, getRawSegmentCount, getRawSegmentLength, getVariableSegmentCount, hashCode, nest, normalizeNested, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
match
protected static final java.lang.String VARIABLE_MATCH_PATTERN
protected java.lang.StringBuilder pattern
protected java.util.List<UriMatchVariable> variables
public UriMatchTemplate(java.lang.CharSequence templateString)
templateString
- The template stringprotected UriMatchTemplate(java.lang.CharSequence templateString, java.lang.Object... parserArguments)
templateString
- The template stringparserArguments
- The parsed argumentsprotected UriMatchTemplate(java.lang.CharSequence templateString, java.util.List<UriTemplate.PathSegment> segments, java.util.regex.Pattern matchPattern, java.util.List<UriMatchVariable> variables)
templateString
- The templatesegments
- The list of segmentsmatchPattern
- The match patternvariables
- The variablesprotected UriMatchTemplate newUriMatchTemplate(java.lang.CharSequence uriTemplate, java.util.List<UriTemplate.PathSegment> newSegments, java.util.regex.Pattern newPattern, java.util.List<UriMatchVariable> variables)
uriTemplate
- The templatenewSegments
- The list of new segmentsnewPattern
- The list of new pattersvariables
- The variablesUriMatchTemplate
public java.util.List<java.lang.String> getVariableNames()
public java.util.List<UriMatchVariable> getVariables()
public java.lang.String toPathString()
public java.util.Optional<UriMatchInfo> match(java.lang.String uri)
match
in interface UriMatcher
uri
- The uRIpublic UriMatchTemplate nest(java.lang.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(java.lang.String uri)
UriTemplate
for the given URI.uri
- The URIprotected UriTemplate newUriTemplate(java.lang.CharSequence uriTemplate, java.util.List<UriTemplate.PathSegment> newSegments)
newUriTemplate
in class UriTemplate
uriTemplate
- The URI templatenewSegments
- The new segmentsUriTemplate
protected UriTemplate.UriTemplateParser createParser(java.lang.String templateString, java.lang.Object... parserArguments)
UriTemplate
createParser
in class UriTemplate
templateString
- The templateparserArguments
- The parsed arguments