public interface RouteMatcher
Equivalent to PathMatcher
, but enables use of parsed representations
of routes and patterns for efficiency reasons in scenarios where routes from
incoming messages are continuously matched against a large number of message
handler patterns.
PathMatcher
Modifier and Type | Interface and Description |
---|---|
static interface |
RouteMatcher.Route
A parsed representation of a route.
|
Modifier and Type | Method and Description |
---|---|
String |
combine(String pattern1,
String pattern2)
Combines two patterns into a single pattern.
|
Comparator<String> |
getPatternComparator(RouteMatcher.Route route)
Given a route, return a
Comparator suitable for sorting patterns
in order of explicitness for that route, so that more specific patterns
come before more generic ones. |
boolean |
isPattern(String route)
Whether the given
route contains pattern syntax which requires
the match(String, Route) method, or if it is a regular String
that could be compared directly to others. |
boolean |
match(String pattern,
RouteMatcher.Route route)
Match the given route against the given pattern.
|
Map<String,String> |
matchAndExtract(String pattern,
RouteMatcher.Route route)
Match the pattern to the route and extract template variables.
|
RouteMatcher.Route |
parseRoute(String routeValue)
Return a parsed representation of the given route.
|
RouteMatcher.Route parseRoute(String routeValue)
routeValue
- the route to parseboolean isPattern(String route)
route
contains pattern syntax which requires
the match(String, Route)
method, or if it is a regular String
that could be compared directly to others.route
- the route to checktrue
if the given route
represents a patternString combine(String pattern1, String pattern2)
pattern1
- the first patternpattern2
- the second patternIllegalArgumentException
- when the two patterns cannot be combinedboolean match(String pattern, RouteMatcher.Route route)
pattern
- the pattern to try to matchroute
- the route to test againsttrue
if there is a match, false
otherwise@Nullable Map<String,String> matchAndExtract(String pattern, RouteMatcher.Route route)
pattern
- the pattern, possibly containing templates variablesroute
- the route to extract template variables fromComparator<String> getPatternComparator(RouteMatcher.Route route)
Comparator
suitable for sorting patterns
in order of explicitness for that route, so that more specific patterns
come before more generic ones.route
- the full path to use for comparison