Package com.yahoo.jdisc.application
Class UriPattern.Match
- java.lang.Object
-
- com.yahoo.jdisc.application.UriPattern.Match
-
- Enclosing class:
- UriPattern
public static class UriPattern.Match extends Object
This class holds the result of a
UriPattern.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 theUriPattern
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
group(int idx)
Returns the input subsequence captured by the given group by this match.int
groupCount()
Returns the number of captured groups of this match.
-
-
-
Method Detail
-
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
public String group(int idx)
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.
-
-