@@ -38,15 +38,23 @@ public interface RequestMatcher {
38
38
boolean matches (HttpServletRequest request );
39
39
40
40
/**
41
- * @since 5.2
41
+ * Returns a MatchResult for this RequestMatcher
42
+ * The default implementation returns {@link Collections#emptyMap()}
43
+ * when {@link MatchResult#getVariables()} is invoked.
44
+ *
45
+ * @return the MatchResult from comparing this RequestMatcher against the HttpServletRequest
46
+ * @since 5.2
42
47
*/
43
48
default MatchResult matcher (HttpServletRequest request ) {
44
49
boolean match = matches (request );
45
50
return new MatchResult (match , Collections .emptyMap ());
46
51
}
47
52
48
53
/**
49
- * The result of matching
54
+ * The result of matching against an HttpServletRequest
55
+ * Contains the status, true or false, of the match and
56
+ * if present, any variables extracted from the match
57
+ * @since 5.2
50
58
*/
51
59
class MatchResult {
52
60
private final boolean match ;
@@ -57,10 +65,18 @@ class MatchResult {
57
65
this .variables = variables ;
58
66
}
59
67
68
+ /**
69
+ * @return true if the comparison against the HttpServletRequest produced a successful match
70
+ */
60
71
public boolean isMatch () {
61
72
return this .match ;
62
73
}
63
74
75
+ /**
76
+ * Returns the extracted variable values where the key is the variable name and the value is the variable value
77
+ *
78
+ * @return a map containing key-value pairs representing extracted variable names and variable values
79
+ */
64
80
public Map <String , String > getVariables () {
65
81
return this .variables ;
66
82
}
0 commit comments