PathMatcher class abstract interface

Tests paths such as config/dev/app.properties against patterns with wildcards such as config/**/*.properties, and pulls values out of them.

The resource pattern resolver and @PropertySource use it to expand location patterns. AntPathMatcher is the only implementation; applications rarely need either, but can use one for their own matching of paths or dotted names.

// Which uploaded files are stylesheets.
final PathMatcher matcher = AntPathMatcher();
matcher.match('/static/**/*.css', '/static/css/app.css'); // true

Spring (Java):

PathMatcher matcher = new AntPathMatcher();
matcher.match("/static/**/*.css", "/static/css/app.css"); // true
Implementers

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

combine(String pattern1, String pattern2) → String
Joins two patterns into one, such as a prefix and a sub-pattern: /hotels/* and /booking give /hotels/booking.
extractPathWithinPattern(String pattern, String path) → String
The part of path matched by the wildcard part of pattern, such as the file path below a mapped directory.
extractUriTemplateVariables(String pattern, String path) → Map<String, String>
The values of the {name} variables of pattern in path, by name.
getPatternComparator(String path) → Comparator<String>
A comparator that sorts patterns from the most to the least specific for path, to pick the best of several matching patterns. A pattern equal to path comes first and /** last.
isPattern(String path) → bool
Whether path contains pattern syntax (*, ? or a {name} variable), so it must be matched rather than compared.
match(String pattern, String path) → bool
Whether the whole of path matches pattern.
matchStart(String pattern, String path) → bool
Whether path matches the beginning of pattern, so a longer path starting with it could still match. Used to skip directories that cannot contain a match.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited