Package org.apache.juneau.rest.util
Class UrlPathMatcher
java.lang.Object
org.apache.juneau.rest.util.UrlPathMatcher
- All Implemented Interfaces:
Comparable<UrlPathMatcher>
A parsed path pattern constructed from a
@RestOp(path)
value.
Handles aspects of matching and precedence ordering.
See Also:
-
Method Summary
Modifier and TypeMethodDescriptionint
Comparator for this object.protected abstract String
Returns a string that can be used to compare this matcher with other matchers to provide the ability to order URL patterns from most-specific to least-specific.String[]
getVars()
Returns the variable names found in the pattern.boolean
hasVars()
Returnstrue if this path pattern contains variables.abstract UrlPathMatch
Returns a non-null value if the specified path matches this pattern.static UrlPathMatcher
Constructs a matcher from the specified pattern string.toString()
-
Method Details
-
of
Constructs a matcher from the specified pattern string.- Parameters:
pattern
- The pattern string.- Returns:
- A new matcher.
-
match
Returns a non-null value if the specified path matches this pattern.- Parameters:
pathInfo
- The path to match against.- Returns:
- A pattern match object, or
null if the path didn't match this pattern.
-
getComparator
Returns a string that can be used to compare this matcher with other matchers to provide the ability to order URL patterns from most-specific to least-specific.- Returns:
- A comparison string.
-
getVars
Returns the variable names found in the pattern.- Returns:
- The variable names or an empty array if no variables found.
Modifying the returned array does not modify this object.
-
hasVars
Returnstrue if this path pattern contains variables.- Returns:
true if this path pattern contains variables.
-
compareTo
Comparator for this object.The comparator is designed to order URL pattern from most-specific to least-specific. For example, the following patterns would be ordered as follows:
foo.bar *.bar /foo/bar /foo/bar/* /foo/{id}/bar /foo/{id}/bar/* /foo/{id} /foo/{id}/* /foo /foo/*
- Specified by:
compareTo
in interfaceComparable<UrlPathMatcher>
-
toString
-