Top Description Inners Fields Constructors Methods
org.springframework.util

public Class SimpleRouteMatcher

extends Object
implements RouteMatcher
Class Inheritance
All Implemented Interfaces
org.springframework.util.RouteMatcher
Imports
java.util.Comparator, .Map, org.springframework.lang.Nullable

RouteMatcher that delegates to a PathMatcher.

Note

This implementation is not efficient since PathMatcher treats paths and patterns as Strings. For more optimized performance use the PathPatternRouteMatcher from spring-web which enables use of parsed routes and patterns.

Author
Rossen Stoyanchev
Since
5.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final PathMatcher

Constructor Summary

AccessConstructor and Description
public
SimpleRouteMatcher(PathMatcher pathMatcher)

Create a new SimpleRouteMatcher for the given PathMatcher delegate.

Method Summary

Modifier and TypeMethod and Description
public String
combine(String
the first pattern
pattern1
,
String
the second pattern
pattern2
)

Implements org.springframework.util.RouteMatcher.combine.

Combines two patterns into a single pattern.

public PathMatcher
getPathMatcher()

Return the underlying PathMatcher delegate.

public Comparator<String>
getPatternComparator(RouteMatcher.Route
the full path to use for comparison
route
)

Implements org.springframework.util.RouteMatcher.getPatternComparator.

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.

public boolean
isPattern(String
the route to check
route
)

Implements org.springframework.util.RouteMatcher.isPattern.

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.

public boolean
match(String
the pattern to try to match
pattern
,
RouteMatcher.Route
the route to test against
route
)

Implements org.springframework.util.RouteMatcher.match.

Match the given route against the given pattern.

public Map<String, String>
matchAndExtract(String
the pattern, possibly containing templates variables
pattern
,
RouteMatcher.Route
the route to extract template variables from
route
)

Implements org.springframework.util.RouteMatcher.matchAndExtract.

Match the pattern to the route and extract template variables.

public RouteMatcher.Route
parseRoute(String
the route to parse
route
)

Implements org.springframework.util.RouteMatcher.parseRoute.

Return a parsed representation of the given route.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pathMatcherback to summary
private final PathMatcher pathMatcher

Constructor Detail

SimpleRouteMatcherback to summary
public SimpleRouteMatcher(PathMatcher pathMatcher)

Create a new SimpleRouteMatcher for the given PathMatcher delegate.

Method Detail

combineback to summary
public String combine(String pattern1, String pattern2)

Implements org.springframework.util.RouteMatcher.combine.

Doc from org.springframework.util.RouteMatcher.combine.

Combines two patterns into a single pattern.

Parameters
pattern1:String

the first pattern

pattern2:String

the second pattern

Returns:String

the combination of the two patterns

Annotations
@Override
getPathMatcherback to summary
public PathMatcher getPathMatcher()

Return the underlying PathMatcher delegate.

getPatternComparatorback to summary
public Comparator<String> getPatternComparator(RouteMatcher.Route route)

Implements org.springframework.util.RouteMatcher.getPatternComparator.

Doc from org.springframework.util.RouteMatcher.getPatternComparator.

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.

Parameters
route:RouteMatcher.Route

the full path to use for comparison

Returns:Comparator<String>

a comparator capable of sorting patterns in order of explicitness

Annotations
@Override
isPatternback to summary
public boolean isPattern(String route)

Implements org.springframework.util.RouteMatcher.isPattern.

Doc from org.springframework.util.RouteMatcher.isPattern.

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.

Parameters
route:String

the route to check

Returns:boolean

true if the given route represents a pattern

Annotations
@Override
matchback to summary
public boolean match(String pattern, RouteMatcher.Route route)

Implements org.springframework.util.RouteMatcher.match.

Doc from org.springframework.util.RouteMatcher.match.

Match the given route against the given pattern.

Parameters
pattern:String

the pattern to try to match

route:RouteMatcher.Route

the route to test against

Returns:boolean

true if there is a match, false otherwise

Annotations
@Override
matchAndExtractback to summary
public Map<String, String> matchAndExtract(String pattern, RouteMatcher.Route route)

Implements org.springframework.util.RouteMatcher.matchAndExtract.

Doc from org.springframework.util.RouteMatcher.matchAndExtract.

Match the pattern to the route and extract template variables.

Parameters
pattern:String

the pattern, possibly containing templates variables

route:RouteMatcher.Route

the route to extract template variables from

Returns:Map<String, String>

a map with template variables and values

Annotations
@Override
@Nullable
parseRouteback to summary
public RouteMatcher.Route parseRoute(String route)

Implements org.springframework.util.RouteMatcher.parseRoute.

Doc from org.springframework.util.RouteMatcher.parseRoute.

Return a parsed representation of the given route.

Parameters
route:String

the route to parse

Returns:RouteMatcher.Route

the parsed representation of the route

Annotations
@Override
org.springframework.util back to summary

private Class SimpleRouteMatcher.DefaultRoute

extends Object
implements Route
Class Inheritance
All Implemented Interfaces
org.springframework.util.RouteMatcher.Route

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public String
value()

Implements org.springframework.util.RouteMatcher.Route.value.

The original route value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

pathback to summary
private final String path

Constructor Detail

DefaultRouteback to summary
pack-priv DefaultRoute(String path)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
valueback to summary
public String value()

Implements org.springframework.util.RouteMatcher.Route.value.

Doc from org.springframework.util.RouteMatcher.Route.value.

The original route value.

Annotations
@Override