Class Matcher


  • public final class Matcher
    extends java.lang.Object
    Utility class for matching Patterns against Pathes.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static MatchResult findMatch​(Pattern pattern, Path input)
      Find the first match of a pattern in a path.
      static MatchResult findMatch​(Pattern pattern, Path input, int pos)
      Find the first match of a pattern in a path starting at a given position.
      static Path match​(Pattern pattern, Path input)
      Match a pattern against an input path and return the remaining path.
      static boolean matches​(Pattern pattern, Path input)
      Checks whether a pattern matches an input path.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • match

        public static Path match​(Pattern pattern,
                                 Path input)
        Match a pattern against an input path and return the remaining path.
        Parameters:
        pattern -
        input -
        Returns:
        The remaining path after the match or null if the whole path was matched.
        See Also:
        MatchResult.getRemainder()
      • matches

        public static boolean matches​(Pattern pattern,
                                      Path input)
        Checks whether a pattern matches an input path.
        Parameters:
        pattern -
        input -
        Returns:
        true if pattern matches the whole input.
        See Also:
        MatchResult.isFullMatch()
      • findMatch

        public static MatchResult findMatch​(Pattern pattern,
                                            Path input)
        Find the first match of a pattern in a path.
        Parameters:
        pattern -
        input -
        Returns:
        A MatchResult or null if the pattern does not occur in the input.
        Throws:
        java.lang.IllegalArgumentException - if input is not normalized.
      • findMatch

        public static MatchResult findMatch​(Pattern pattern,
                                            Path input,
                                            int pos)
        Find the first match of a pattern in a path starting at a given position.
        Parameters:
        pattern -
        input -
        pos -
        Returns:
        A MatchResult or null if the pattern does not occur in the input.
        Throws:
        java.lang.IllegalArgumentException - if input is not normalized.