Class GlobPathMatcher


  • public class GlobPathMatcher
    extends java.lang.Object
    Freely adapted from Spring's AntPathMatcher. We don't use the file system's glob PathMatcher because it can't detect directories which can't be a start of a match.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_PATH_SEPARATOR
      Default path separator: "/"
    • Constructor Summary

      Constructors 
      Constructor Description
      GlobPathMatcher​(java.lang.String pattern)
      Create a new instance with the DEFAULT_PATH_SEPARATOR.
      GlobPathMatcher​(java.lang.String pattern, java.lang.String pathSeparator, boolean caseSensitive)
      A convenient, alternative constructor to use with a custom path separator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean matches​(java.lang.String path, boolean fullMatch)
      Actually match the given path against the given pattern.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_PATH_SEPARATOR

        public static final java.lang.String DEFAULT_PATH_SEPARATOR
        Default path separator: "/"
        See Also:
        Constant Field Values
    • Constructor Detail

      • GlobPathMatcher

        public GlobPathMatcher​(java.lang.String pattern)
        Create a new instance with the DEFAULT_PATH_SEPARATOR.
        Parameters:
        pattern - the pattern
      • GlobPathMatcher

        public GlobPathMatcher​(java.lang.String pattern,
                               java.lang.String pathSeparator,
                               boolean caseSensitive)
        A convenient, alternative constructor to use with a custom path separator.
        Parameters:
        pattern - the pattern
        pathSeparator - the path separator to use, must not be null.
        caseSensitive - is case sensitive
    • Method Detail

      • matches

        public boolean matches​(java.lang.String path,
                               boolean fullMatch)
        Actually match the given path against the given pattern.
        Parameters:
        path - the path String to test
        fullMatch - whether a full pattern match is required (else a pattern match as far as the given base path goes is sufficient)
        Returns:
        true if the supplied path matched, false if it didn't