Class UriPattern.Match

  • Enclosing class:
    UriPattern

    public static class UriPattern.Match
    extends java.lang.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 the UriPattern.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 java.lang.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:
        java.lang.IndexOutOfBoundsException - If there is no group in the match with the given index.