Class AntPathMatcher

java.lang.Object
io.github.connellite.match.AntPathMatcher

public class AntPathMatcher extends Object
Ant-style path matcher adapted from Spring Framework AntPathMatcher.

Matching rules:

  • ? matches one character within a path segment
  • * matches zero or more characters within a path segment
  • ** matches zero or more path segments

Source: org.springframework.util.AntPathMatcher

  • Field Details

    • DEFAULT_PATH_SEPARATOR

      public static final String DEFAULT_PATH_SEPARATOR
      Default path separator ("/").
      See Also:
  • Constructor Details

    • AntPathMatcher

      public AntPathMatcher()
      Creates a matcher with DEFAULT_PATH_SEPARATOR and case-sensitive matching.
    • AntPathMatcher

      public AntPathMatcher(String pathSeparator, boolean caseSensitive)
      Creates a matcher with the given separator and case-sensitivity.
      Parameters:
      pathSeparator - separator between path segments; must not be null
      caseSensitive - whether segment matching is case-sensitive
  • Method Details

    • match

      public boolean match(String pattern, String path)
      Returns whether path matches pattern.
      Parameters:
      pattern - ant-style path pattern
      path - path to test
      Returns:
      true when the whole path matches the pattern