Class BindingMatch<T>
- Type Parameters:
T
- The class of the target.
This class holds the result of a BindingSet.match(URI)
operation. It contains methods to inspect the
groups captured during matching, where a group is defined as a sequence of characters matches by a wildcard
in the UriPattern
, and to retrieve the matched target.
-
Constructor Summary
ConstructorDescriptionBindingMatch
(UriPattern.Match match, T target, UriPattern matched) Constructs a new instance of this class. -
Method Summary
-
Constructor Details
-
BindingMatch
Constructs a new instance of this class.
- Parameters:
match
- The match information for this instance.target
- The target of this match.matched
- The matched URI pattern- Throws:
NullPointerException
- If any argument is null.
-
-
Method Details
-
groupCount
public int groupCount()Returns the number of captured groups of this match. Any non-negative integer smaller than the value returned by this method is a valid group index for this match.
- Returns:
- The number of captured groups.
-
group
Returns the input subsequence captured by the given group by this match. Groups are indexed from left to right, starting at zero. Note that some groups may match an empty string, in which case this method returns the empty string. This method never returns null.
- Parameters:
idx
- The index of the group to return.- Returns:
- The (possibly empty) substring captured by the group during matching, never
null
. - Throws:
IndexOutOfBoundsException
- If there is no group in the match with the given index.
-
target
Returns the matched target.
- Returns:
- The matched target.
-
matched
Returns the URI pattern that was matched.
- Returns:
- The matched pattern.
-