Class WildcardPath


  • public class WildcardPath
    extends Object
    Holds a String with wildcards ('*'), and can answer whether a given string matches this WildcardPath. For example: "foo.*.baz" or "foo*baz.bar*" The '*' in "foo*bar" is treated the same way that java regex treats "(.*)", and all WildcardPath's are considered to match child paths. For example, "foo.bar" will match "foo.bar.baz". It will not match "foo.barbaz" however. To match "foo.barbaz" the pattern "foo.bar*" could be used, which would also match "foo.barbaz.x" Only '*' is considered a special character. All other characters are not treated as special characters, including '{', '}', '.', and '/' with one exception -- the delimiter character is used for matching against child paths as explained above. It is assumed that {} globs have already been expanded before constructing this object.
    • Constructor Detail

      • WildcardPath

        public WildcardPath​(String parentGlobPath,
                            String wildcardPath,
                            char delim)
    • Method Detail

      • buildRegex

        public static String buildRegex​(String wildcardPath,
                                        char delim)
      • matches

        public boolean matches​(String path)
      • getParentGlobPath

        public String getParentGlobPath()
      • getOriginalPattern

        public String getOriginalPattern()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object