public class PathPatternRouteMatcher extends Object implements RouteMatcher
RouteMatcher built on PathPatternParser that uses
PathContainer and PathPattern as parsed representations of
routes and patterns.RouteMatcher.Route| Constructor and Description |
|---|
PathPatternRouteMatcher()
Default constructor with
PathPatternParser customized for
MESSAGE_ROUTE
and without matching of trailing separator. |
PathPatternRouteMatcher(PathPatternParser parser)
Constructor with given
PathPatternParser. |
| 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 RouteMatcher.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.
|
public PathPatternRouteMatcher()
PathPatternParser customized for
MESSAGE_ROUTE
and without matching of trailing separator.public PathPatternRouteMatcher(PathPatternParser parser)
PathPatternParser.public RouteMatcher.Route parseRoute(String routeValue)
RouteMatcherparseRoute in interface RouteMatcherrouteValue - the route to parsepublic boolean isPattern(String route)
RouteMatcherroute contains pattern syntax which requires
the RouteMatcher.match(String, Route) method, or if it is a regular String
that could be compared directly to others.isPattern in interface RouteMatcherroute - the route to checktrue if the given route represents a patternpublic String combine(String pattern1, String pattern2)
RouteMatchercombine in interface RouteMatcherpattern1 - the first patternpattern2 - the second patternpublic boolean match(String pattern, RouteMatcher.Route route)
RouteMatchermatch in interface RouteMatcherpattern - the pattern to try to matchroute - the route to test againsttrue if there is a match, false otherwise@Nullable public Map<String,String> matchAndExtract(String pattern, RouteMatcher.Route route)
RouteMatchermatchAndExtract in interface RouteMatcherpattern - the pattern, possibly containing templates variablesroute - the route to extract template variables frompublic Comparator<String> getPatternComparator(RouteMatcher.Route route)
RouteMatcherComparator suitable for sorting patterns
in order of explicitness for that route, so that more specific patterns
come before more generic ones.getPatternComparator in interface RouteMatcherroute - the full path to use for comparison