public class UriTemplateParser extends Object
Modifier and Type | Field and Description |
---|---|
static Pattern |
MATCH_NUMBER_OF_MAX_LENGTH_4 |
static Pattern |
TEMPLATE_VALUE_PATTERN
Default URI template value regexp pattern.
|
static Pattern |
TEMPLATE_VALUE_PATTERN_MULTI |
Constructor and Description |
---|
UriTemplateParser(String template)
Parse a template.
|
Modifier and Type | Method and Description |
---|---|
protected String |
encodeLiteralCharacters(String characters)
Encode literal characters of a template.
|
List<Integer> |
getGroupCounts()
Get the capturing group counts for each template variable.
|
int[] |
getGroupIndexes()
Get the group indexes to capturing groups.
|
List<UriPart> |
getNames()
Get the list of template names.
|
Map<String,Pattern> |
getNameToPattern()
Get the map of template names to patterns.
|
String |
getNormalizedTemplate()
Get the normalized template.
|
int |
getNumberOfExplicitRegexes()
Get the number of explicit regular expressions.
|
int |
getNumberOfLiteralCharacters()
Get the number of literal characters.
|
int |
getNumberOfRegexGroups()
Get the number of regular expression groups
|
Pattern |
getPattern()
Get the pattern.
|
String |
getTemplate()
Get the template.
|
List<UriPart> |
getUriParts()
Get a collection of uri parts (static strings and dynamic arguments) as parsed by the parser.
|
public static final Pattern TEMPLATE_VALUE_PATTERN
public static final Pattern TEMPLATE_VALUE_PATTERN_MULTI
public static final Pattern MATCH_NUMBER_OF_MAX_LENGTH_4
public UriTemplateParser(String template) throws IllegalArgumentException
template
- the template.IllegalArgumentException
- if the template is null, an empty string
or does not conform to a JAX-RS URI template.public final String getTemplate()
public final Pattern getPattern()
public final String getNormalizedTemplate()
A normalized template is a template without any explicit regular expressions.
public final Map<String,Pattern> getNameToPattern()
public final List<UriPart> getNames()
public List<UriPart> getUriParts()
names
and other parts that do not have a template.public final List<Integer> getGroupCounts()
public final int[] getGroupIndexes()
Any nested capturing groups will be ignored and the the group index will refer to the top-level capturing groups associated with the templates variables.
public final int getNumberOfExplicitRegexes()
public final int getNumberOfRegexGroups()
public final int getNumberOfLiteralCharacters()
Copyright © 2007-2023, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.