A URI pattern is used to create a URI matcher to perform match operation on URI against against a regular expression built from a URI Builder's components.
A URI pattern is created from a URI builder by invoking the builder's
buildPattern
or
buildPathPattern
methods. It is then
used to create URI matchers that performs match operations on an input URI
string.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Describes the inclusion state of a URI pattern in another URI pattern. -
Method Summary
Modifier and TypeMethodDescriptionReturn the underlying JDK pattern.Return the URI regular expression.getValue()
Returns the raw value of the pattern.includes
(URIPattern pattern) Determines whether the set of URIs matched by the specified URI pattern is included in the set of URIs matched by this URI pattern.Creates a matchers that will match the specified input URI against this pattern.
-
Method Details
-
getPattern
Pattern getPattern()Return the underlying JDK pattern.
- Returns:
- a pattern
-
getPatternString
String getPatternString()Return the URI regular expression.
- Returns:
- a regular expression
-
getValue
String getValue()Returns the raw value of the pattern.
- Returns:
- the pattern's raw value
-
matcher
Creates a matchers that will match the specified input URI against this pattern.
- Parameters:
uri
- The URI to match- Returns:
- a URI matcher
-
includes
Determines whether the set of URIs matched by the specified URI pattern is included in the set of URIs matched by this URI pattern.
Considering A: the set of URIs matched by the specified URI pattern, and B: the set of URIs matched by this URI pattern, this method should return:
URIPattern.Inclusion.INCLUDED
when A is included in BURIPattern.Inclusion.DISJOINT
when A and B are disjointURIPattern.Inclusion.INDETERMINATE
when it wasn't possible to determine inclusion with certainty or if the difference between A and B is not empty
Implementations can choose to focus on specific URI components such as path in which case this method must return
URIPattern.Inclusion.INDETERMINATE
when other components are considered. Parameter names must also be ignored by implementations (eg. /{x} should be considered as equivalent to /{y}).- Parameters:
pattern
- a URI pattern- Returns:
- a pattern inclusion state specifying whether the specified pattern is included in this pattern
-